I have a function that handles scrolls every period of time. This function works when users scroll with mouse wheel:
let shouldHandle = true
window.addEventListener('wheel', e => {
if (shouldHandle) {
handleScroll(e) // I will handle scrolls here
shouldHandle = false
setTimeout(() => {
shouldHandle = true
}, 750)
}
})
However, when I am scrolling using my laptop's touchpad, scroll still happens even when I remove my finger (especially when I accelerate my finger enough and scroll, then immediately remove my finger from the touchpad). As a result, scroll still happens after the 750ms
even when the users are not technically scrolling. This question has been asked here. The question did not receive an answer to handle this behavior.
I want to handle scroll only after a period of time has elapsed from the last scroll. The scrolls I want to handle must not be because of scrolling caused by this "predictive touch" scroll. Is there a way to achieve this as of now?