{
    分享网正式开通,我们为大家提供免费资源,欢迎大家踊跃投稿!

jQuery页面滚动左侧悬浮固定导航菜单代码

这是一款页面滚动下拉的时候左侧悬浮固定导航菜单代码,jQuery页面滚动固定层菜单网页特效下载。


js代码

<script type="text/javascript">
	$(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
				else if($(document).height()==$(window).scrollTop()+$(window).height()){
					$('.fl_l li').removeClass('active');
					$('.fl_l li').eq($('.fl_r li').length-1).addClass('active');
				}
			});
		});
		$('.fl_l li').click(function(){
			$(this).addClass('active').siblings().removeClass('active');
			var _i=$(this).index();
			 $('body, html').animate({scrollTop:$('.fl_r li').eq(_i).offset().top-_line},500);
		});
	});
</script>


在线预览
资源均来自第三方,谨慎下载,前往第三方网站下载


爱资源分享网 , 版权所有丨本站资源仅限于学习研究,严禁从事商业或者非法活动!丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:jQuery页面滚动左侧悬浮固定导航菜单代码
喜欢 ()分享 (0)