jquery 判断鼠标向上滚动还是向下滚动
var cur = 0;
$(document).scroll(function(){
var top = $(document).scrollTop();
console.log(top>cur?'向下':'向上');
cur = top;
})
注意:需要引入Jquery
jquery 判断鼠标向上滚动还是向下滚动
var cur = 0;
$(document).scroll(function(){
var top = $(document).scrollTop();
console.log(top>cur?'向下':'向上');
cur = top;
})
注意:需要引入Jquery