Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

window.onscroll mobile equivalent?

On desktop browsers, window.scroll fires off continuously as the browser is scrolled. However, in my testing on iOS and Android Chrome, it only fires when the scrolling has finished.

I tried touchmove but that had the same behavior - only firing when the movement finished.

Is there an event on mobile devices that fires continuously, like a desktop browser?

like image 525
Jeff Avatar asked Aug 20 '14 18:08

Jeff


People also ask

How does onScroll work?

Definition and Usage. The onscroll event occurs when an element's scrollbar is being scrolled. Tip: use the CSS overflow style property to create a scrollbar for an element.

How do you know if scroll is up or down?

When the page scroll happens, compare the previous scrollY value with the current scrollY . If the current value is greater than the old value, then the scroll direction is downwards. Otherwise, the scroll direction is upwards.


2 Answers

Apparently there's no way to get passed it because the "iOS devices freeze the DOM manipulation during the scroll event"!

Take a look at this link the scroll start section! http://demos.jquerymobile.com/1.0/docs/api/events.html

like image 167
Amin Jafari Avatar answered Sep 30 '22 01:09

Amin Jafari


Might want to take a look at this site:

http://andyshora.com/mobile-scroll-event-problems.html

It helps explains why your going to be banging you head against a wall.

like image 39
Pseudonym Avatar answered Sep 30 '22 03:09

Pseudonym