0

I've found in IE (and IE Edge), I get too many scroll events for too long a time. A flick on the mousepad can result in anywhere from 1-1.8 seconds of scroll events being fired.

I cannot set a throttle of 2 seconds as that's too long and will cause users to get frustrated.

I tried also checking that the events were not too close together (50ms or less) but if the user executes a new scroll during the previous one going and their scroll starts at 45ms after the last "extra" scroll event was fired by IE, then it starts a whole new 1-1.8 seconds of events (and this can go on forever).

The only thing that would solve this is if I can have a scroll start (similar to mousedown).

My incorrect attempt at a solution:

var lastEventTime = 0;
var lastTime = 0;

function scrollListener()
{
    let now = new Date().getTime();

    //Not listening, still scrolling
    //Delay of 1 second isn't long enough
    //50 milliseconds works 90% of the time, but I can initiate under that sometimes
    if (    now < ( lastTime + 1000 ) || now - lastEventTime < 50 )
    )
    {
        //Update event time
        lastEventTime = now;

        //Don't do rest of function
        return;
    }

    ...elided...
}
Don Rhummy
  • 24,730
  • 42
  • 175
  • 330
  • Won't the second part of [this answer](http://stackoverflow.com/a/13321177/2008111) or [this answer](http://stackoverflow.com/a/4620986/2008111) help you ? – caramba Dec 29 '16 at 21:16
  • @caramba Unfortunately, no. Try the demos in there and while it's still scrolling, try to initiate a new scroll. It won't execute the alert until your second one also ends. So it "chains". – Don Rhummy Dec 29 '16 at 21:18
  • Hi, touchpad settings have been problematic on Windows10... Assuming you have installed all updates for Windows 10 and are on the Anniversary edition... try disabling multi-touch support in the mouse control panel or test with a real mouse, not the touchpad. You should also test for pointer and touch event handling and gestures. – Rob Parsons Jan 02 '17 at 00:18
  • I've just written a small script to track `start`, `scroll`, `ended` events on scroll. Syntax is similar to `.addEventListener()`. Can be found at [github.com/akinuri/scroll](https://github.com/akinuri/scroll). Here's a [demo](https://akinuri.github.io/scroll/). – akinuri Apr 29 '19 at 12:23

0 Answers0