Skip to content

Instantly share code, notes, and snippets.

View jpattishall's full-sized avatar

Jack jpattishall

View GitHub Profile
@jpattishall
jpattishall / TouchTimerWorkaround.js
Last active September 1, 2022 07:58
setTimeout workaround for iPad and iOS6
/**
Workaround for iOS 6 setTimeout bug using requestAnimationFrame to simulate timers during Touch/Gesture-based events
Author: Jack Pattishall (jpattishall@gmail.com)
This code is free to use anywhere (MIT, etc.)
Note: UIWebView does not support requestAnimationFrames. If your timer is failing during a scroll event,
take a look at https://gist.github.com/ronkorving/3755461 for a potential workaround.
Usage: Pass TRUE as the final argument for setTimeout or setInterval.