关闭边栏(ESC)打开边栏(ESC)
如本站导航条,在滚动条向下滚动一段距离后,导航会隐藏,向上滚动的时候再次显示
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$(window).scroll(function(){ var before = $(window).scrollTop(); $(window).scroll(function() { var after = $(window).scrollTop(); if (before<after) { console.log('上'); before = after; }; if (before>after) { console.log('下'); before = after; }; }); }); |