jQuery实现下滚不显示,上滚出现的粘性导航

代码

/粘性导航
    var basic = 80;
    $(window).scroll(function () {
        var top = $(window).scrollTop();
        if (top > basic) {
            $('header').removeClass("header_fixed");
        } else if (top < basic && top > 80) {
            $('header').addClass("header_fixed");
        }else if(top < 80){
            $('header').removeClass("header_fixed");
        }
        basic = top;
    });

本文作者:蚂蚁追风筝

本文链接:https://www.cnblogs.com/ouhouyi/p/16633626.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @ 2022-08-28 20:51  蚂蚁追风筝  阅读(21)  评论(0编辑  收藏  举报