我怎么能做这样的事情?
myfunction () {
if (notscrolling) {
// do stuff
}
}
这是我能找到的最佳解决方案:
它获取当前滚动位置,然后在 5 毫秒后再次获取。如果数字相同,则页面不滚动!不需要全局变量。
myfunction () {
var a = $(document).scrollTop();
setTimeout(function() {
var b = $(document).scrollTop();
if (a === b) {
// do stuff here cuz its not scrolling :) !!!!
}
}, 5);
}