Mr_Chimp
Mr_Chimp

Reputation: 6917

Detect which browsers fire continuous scroll events (as opposed to only on scroll end)

Desktop browsers fire scroll events continuously while the window is scrolled. Mobile devices generally fire an event once, at the end of the scroll.

I am doing some fancy stuff which only works if I can get the continuous scroll events - otherwise it just looks nasty. It would be trivial to just bypass this and implement a mobile-friendly version in single-scroll-event browsers but how can I detect whether a browser emits a single scroll event or continuous scroll events?

It seems my only option is to sniff the browser and disable this feature for mobile - which means probably disabling it in the few mobile browsers that support continuous scroll events - or leaving it enabled and allowing it to look a bit crappy in the single-event browsers.

Upvotes: 5

Views: 261

Answers (1)

rahul chaurasia
rahul chaurasia

Reputation: 153

If i am correctly understand your question. so my advice is create a variable and increase its values with + 1 everytime and alert it in your function which called on scroll. create variable out of function

Upvotes: 1

Related Questions