How can I do something like this?
myfunction () {
if (notscrolling) {
// do stuff
}
}
This is the best solution that I could find:
It gets the current scroll position, then gets it again 5 milliseconds later. If the numbers are the same, then the page is not scrolling! No global variable required.
myfunction () {
var a = $(document).scrollTop();
setTimeout(function() {
var b = $(document).scrollTop();
if (a === b) {
// do stuff here cuz its not scrolling :) !!!!
}
}, 5);
}