RequestAnimationFrame undefined in iOS UIWebView?

requestAnimationFrame seems undefined in a UIWebView . Is there another function that does the same or do I need to use setTimeout ?

+4
source share
1 answer

It seems like this is not supported in all versions of WebKit, so you will have to use a timeout. This site contains an example of creating a cross-platform solution:

 // via http://paulirish.com/2011/requestanimationframe-for-smart-animating/ window.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(/* function */ callback, /* DOMElement */ element){ window.setTimeout(callback, 1000 / 60); }; })(); 
+7
source

All Articles