diff options
Diffstat (limited to 'js/RequestAnimationFrame.js')
| -rw-r--r-- | js/RequestAnimationFrame.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/js/RequestAnimationFrame.js b/js/RequestAnimationFrame.js new file mode 100644 index 0000000..77f85c5 --- /dev/null +++ b/js/RequestAnimationFrame.js @@ -0,0 +1,22 @@ +/** + * Provides requestAnimationFrame in a cross browser way. + * http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + */ + +if ( !window.requestAnimationFrame ) { + + window.requestAnimationFrame = ( function() { + + return window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function( /* function FrameRequestCallback */ callback, /* DOMElement Element */ element ) { + + window.setTimeout( callback, 1000 / 60 ); + + }; + + } )(); + +} |
