How can I detect in javascript if the user is scrolling?
You can setup an interval to keep checking if the user has scrolled then do something accordingly.
Borrowing from the great John Resig in his article.
Example:
let didScroll = false;
window.onscroll = () => didScroll = true;
setInterval(() => {
if ( didScroll ) {
didScroll = false;
console.log('Someone scrolled me!')
}
}, 250);
See live example