这是一款页面滚动左侧悬浮固定层菜单代码,根据左侧悬浮跳动菜单。
$(function(){
//设置标杆
var _line=parseInt($(window).height()/3);
$(window).scroll(function(){
//滚动730px,左侧导航固定定位
if ($(window).scrollTop()>730) {
$('.fl_l').css({'position':'fixed','top':10})
}else{
$('.fl_l').css({'position':'','top':''})
};
$('.fl_l li').eq(0).addClass('active');
//滚动到标杆位置,左侧导航加active
$('.fl_r li').each(function(){
var _target=parseInt($(this).offset().top-$(window).scrollTop()-_line);
var _i=$(this).index();
if (_target<=0) {
$('.fl_l li').removeClass('active');
$('.fl_l li').eq(_i).addClass('active');
}
//如果到达页面底部,给左侧导航最后一个加active
系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791