Issues when user use this on image gallery, etc
drizzlecloudy opened this issue · 1 comments
Hi @gnarf , Im sorry i can't provide example, but, logically, when user use the usual setInterval
or setTimeout
along with this jquery requestAnimationFrame, their gallery would fail when the tab is inactive.
When tab inactive, jquery animation will stop, but the turn of setInterval/setTimeout would continue.
The solution is by providing 'drop-in' replacement for setInterval and setTimeout. Here is the link https://github.com/drizzlecloudy/draf (It also fixes the issues on iOS 6 & 7)
This issue is exactly why requestAnimationFrame
is not in jQuery Core, preferring the native setTimeout
If you read the README.md you can see that I specifically note that this is a problem end-users should be aware of.
IMO - setInterval
and setTimeout
loops to queue animations are generally results of bad code organization and should be avoided at all cost.