JQ实现吸顶效果代码

吸顶下过代码跟简单几行代码就可以了

如果滚动的军力大于100,就改变导航的定位方式,否则就默认

$(function(){
        $(window).scroll(function(){
            if($(window).scrollTop()>100){
                $(".nav").css({"position":"fixed","top":0,"background":"red","width":"100%"});
            }else{
                $(".nav").css({"position":"static"});
            }
        });
    });
文章来自:https://www.cnblogs.com/pangbo1213/p/8642086.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3