Flexible staircase navigation code

$(function(){

$(
‘body’).css(‘background‘,‘#fff‘);
var flag = true; //Controls that when the floor number is clicked, the scroll bar code can be executed when the code execution value of the scroll bar is true. span>
// Scroll bar scroll - find the current floor index control floor number fixed operation button
$(‘.el-scrollbar__wrap‘).scroll(function () {
if (flag) {
var items = $(".div-step");
var menu = $("#menu");
var top = $(document).scrollTop();
var currentId = ""; //The item id where the scroll bar is now
var cl = ‘‘;
var h = $(window).height()/2;
items.each(function () {
var m = $(this);
//m.offset().top represents the value of each item Top position
if (top> m.offset().top-h/2) {
currentId = "#" + m.attr("id");
cl
= m.attr("id");
}
else {
return false;
}
});
var currentLink = menu.find(".active");
if (currentId && currentLink.attr("href") != currentId) {
currentLink.removeClass(
"active");
menu.find(
"[data-name=" + cl + "]").addClass("active");
$(currentId).addClass(
"active").siblings().removeClass("active");
}
}
});
// end When scrolling, fix the menu on the left and navigate to Relative position

// Click the scroll navigation bar on the left start
$(‘.ciclebox‘).click(function () {
var ele = $(this).children( 'a').attr('href');
$(ele).addClass(
‘active’).siblings(‘.div_step’).removeClass(‘active‘);
$(
this).addClass('active').siblings('.ciclebox').removeClass('active'< span style="color: #000000;">);
});
// Click on the left scroll navigation bar end
})

$(function(){

$(
‘body’).css(‘background‘,‘#fff‘);
var flag = true; //Controls that when the floor number is clicked, the scroll bar code can be executed when the code execution value of the scroll bar is true. span>
// Scroll bar scroll - find the current floor index control floor number fixed operation button
$(‘.el-scrollbar__wrap‘).scroll(function () {
if (flag) {
var items = $(".div-step");
var menu = $("#menu");
var top = $(document).scrollTop();
var currentId = ""; //The item id where the scroll bar is now
var cl = ‘‘;
var h = $(window).height()/2;
items.each(function () {
var m = $(this);
//m.offset().top represents the value of each item Top position
if (top> m.offset().top-h/2) {
currentId = "#" + m.attr("id");
cl
= m.attr("id");
}
else {
return false;
}
});
var currentLink = menu.find(".active");
if (currentId && currentLink.attr("href") != currentId) {
currentLink.removeClass(
"active");
menu.find(
"[data-name=" + cl + "]").addClass("active");
$(currentId).addClass(
"active").siblings().removeClass("active");
}
}
});
// end When scrolling, fix the menu on the left and navigate to Relative position

// Click the scroll navigation bar on the left start
$(‘.ciclebox‘).click(function () {
var ele = $(this).children( 'a').attr('href');
$(ele).addClass(
‘active’).siblings(‘.div_step’).removeClass(‘active‘);
$(
this).addClass('active').siblings('.ciclebox').removeClass('active'< span style="color: #000000;">);
});
// Click on the left scroll navigation bar end
})

Leave a Comment

Your email address will not be published.