you can use scroll listener and timers to realize when a user stop scrolling:
let scrolling;
window.addEventListener('scroll',()=>{
window.clearTimeout(scrolling);
//this is to stop the timer when you scroll again
scrolling = window.setTimeout(doSomething(),5000);
//each time you scroll and stop the counter will start
});
const doSomething = ()=>{
.
.
.
};
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…