代码
/粘性导航
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;
});
标签:jQuery,top,粘性,header,basic,下滚,80,fixed
From: https://www.cnblogs.com/ouhouyi/p/16633626.html