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;
    });
posted @ 2022-08-28 20:51  蚂蚁追风筝  阅读(26)  评论(0)    收藏  举报