jQuery判断页面滚动条滚动方向
废话不多说,直接上代码
$(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; }; }); });