I have a div with a webkit-overflow scroll set that I can touch. On iOS, this gives me an updated position during the touchmove event, but after the user releases this event and the last touchhend call completes, before all the events stop, but the div continues to scroll through the pulse.
This is the behavior that I want, but I also want to refresh the page during this impulse scroll.
I call the requestAnimationFrame call when the touchhend event occurs, and I can loop this while the impulse scrolls. But when I get the DOM information, it freezes until the mometnum scroll disappears.
I tried using the scroll position of the scroll element and elementFromPoint, but both of them have only the position that the div scrolled when the touchhend was running, and do not refresh until the momentum scroll ends.
Does anyone know how to get real-time DOM information on iOS (6+ without worrying about 5)
Here is the code I'm using:
var glideStart; var bird_scanner = document.getElementById('bird-scanner'); bird_scanner.addEventListener('touchend',function() { glideStart = null; requestAnimationFrame(glide); }); function glide(timestamp) {
Update
After many attempts on this, I think that it is really impossible without using any library to try to simulate the impulse scrolling instead of using the built-in option (something that I find really does not give, because the results are smooth). Apple is clearly very concerned that it interferes with their pulsed scroll animation and prevents it from displaying properly.
I ended up deleting the scroll by pulses and just discovered the scroll and immediately went through a bunch of elements when triggered.
I noticed a particularly strange behavior. When I had a webkit-overflow scroll: click on the element that scrolled the page up / down and added setTimeout (some_func, 0) to the touchhend event, the function did not start until the momentum scroll ended. When I tried the same thing on a scroll going left / right, he immediately turned on the function. Do not tell me why this is happening, I decided that it was just some strange draw of a webkit.
javascript dom javascript-events ios dom-events touch
Matt mcdonald
source share