$(".fix_nav span").click(function(){ //点击事件触发
                        
            $(this).addClass("cur").siblings().removeClass("cur");
            var Index = $(this).index()+1;
            
            var top = $("#fix_"+Index).offset().top; //获取某个元素距顶部的距离
           $("body,html").animate({scrollTop:(top-60)+"px"},500);//页面滚动到指定高度 
                                    })
                   
  $(window).scroll(function(){//窗口滚动事件触发
    var ws=$(window).scrollTop()//获取当前滚动高度
    if(ws>t){
    $(".fix_nav").addClass("isfix")    
        
    }else{
    $(".fix_nav").removeClass("isfix")    
        
        }
        })                                

 

相关文章:

  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-24
  • 2022-01-19
  • 2021-07-07
  • 2021-06-23
  • 2022-01-22
  • 2021-11-24
  • 2021-11-24
相关资源
相似解决方案