Function Handles Scrolls Every Period Time Function Works Users Scroll Mouse Wheel Let Sho Q43810340
I have a function that handles scrolls every period of time.This function works when users scroll with mouse wheel:
let shouldHandle = truewindow.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, scrollstill happens even when I remove my finger (especially when Iaccelerate my finger enough and scroll, then immediately remove myfinger from the touchpad). As a result, scroll still happens afterthe 750ms even when the users are not technically scrolling. Thisquestion has been asked here. The question did not receive ananswer to handle this behavior.
I want to handle scroll only after a period of time has elapsedfrom the last scroll. The scrolls I want to handle must not bebecause of scrolling caused by this “predictive touch” scroll. Isthere a way to achieve this as of now?
The programming language is Javascript
Expert Answer
Answer to I have a function that handles scrolls every period of time. This function works when users scroll with mouse wheel: let…
OR