var before = $(window).scrollTop();
//滚动事件
$(window).scroll(function() {
var after = $(window).scrollTop();
if (after > before) {
console.log('下')
before = after;
} else {
console.log('上')
before = after;
}
})