It seems if I'm scrolling the window
, the window.setInterval
doesn't get attached / fired while the scrolling is happening or after. Has anyone else seen the same issue?
I mean...
setInterval() The setInterval() method, offered on the Window and Worker interfaces, repeatedly calls a function or executes a code snippet, with a fixed time delay between each call. This method returns an interval ID which uniquely identifies the interval, so you can remove it later by calling clearInterval() .
The setInterval() method calls a function at specified intervals (in milliseconds). The setInterval() method continues calling the function until clearInterval() is called, or the window is closed. 1 second = 1000 milliseconds.
Answer: Use the clearInterval() Method The setInterval() method returns an interval ID which uniquely identifies the interval. You can pass this interval ID to the global clearInterval() method to cancel or stop setInterval() call.
iOS halts almost everything in response to user touch to guarantee it feels responsive. The setInterval issue is known, and there doesn't appear to be a workaround.
setInterval pauses in iphone/ipad (mobile Safari) during scrolling
EDIT
During the "freeze" the timer will not catch up once the user releases the screen. The missed events are not deferred, but lost entirely (a bug).
Found this (scary but amazing) workaround, and it's working for me in iOS 6.0:
https://gist.github.com/3755461
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With