Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 593
Mr_Chimp Avatar asked Nov 10 '22 14:11

Mr_Chimp


1 Answers

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

like image 145
rahul chaurasia Avatar answered Nov 14 '22 23:11

rahul chaurasia