搜索附件  
自丢网 附件中心 模板下载 网页特效 菜单导航代码 jQuery页面滚动左侧悬浮固定导航菜单代码.zip

热门下载

左侧广告
版权所有:自丢网
For 2020-2050 © zidiu.com

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

 

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


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

  2. <script type="text/javascript">
  3.         $(function(){
  4.                 //设置标杆
  5.                 var _line=parseInt($(window).height()/3);
  6.                 $(window).scroll(function(){
  7.                         //滚动730px,左侧导航固定定位
  8.                         if ($(window).scrollTop()>730) {
  9.                                 $('.fl_l').css({'position':'fixed','top':10})
  10.                         }else{
  11.                                 $('.fl_l').css({'position':'','top':''})
  12.                         };
  13.                         $('.fl_l li').eq(0).addClass('active');
  14.                         //滚动到标杆位置,左侧导航加active
  15.                         $('.fl_r li').each(function(){
  16.                                 var _target=parseInt($(this).offset().top-$(window).scrollTop()-_line);
  17.                                 var _i=$(this).index();
  18.                                 if (_target<=0) {
  19.                                         $('.fl_l li').removeClass('active');
  20.                                         $('.fl_l li').eq(_i).addClass('active');
  21.                                 }
  22.                                 //如果到达页面底部,给左侧导航最后一个加active
  23.                                 else if($(document).height()==$(window).scrollTop()+$(window).height()){
  24.                                         $('.fl_l li').removeClass('active');
  25.                                         $('.fl_l li').eq($('.fl_r li').length-1).addClass('active');
  26.                                 }
  27.                         });
  28.                 });
  29.                 $('.fl_l li').click(function(){
  30.                         $(this).addClass('active').siblings().removeClass('active');
  31.                         var _i=$(this).index();
  32.                          $('body, html').animate({scrollTop:$('.fl_r li').eq(_i).offset().top-_line},500);
  33.                 });
  34.         });
  35. </script>
复制代码