File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -171,3 +171,33 @@ module.exports.ThemeNav = ThemeNav();
171171if ( typeof ( window ) != 'undefined' ) {
172172 window . SphinxRtdTheme = { StickyNav : module . exports . ThemeNav } ;
173173}
174+
175+
176+ // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
177+ // https://gist.github.com/paulirish/1579671
178+ // MIT license
179+
180+ ( function ( ) {
181+ var lastTime = 0 ;
182+ var vendors = [ 'ms' , 'moz' , 'webkit' , 'o' ] ;
183+ for ( var x = 0 ; x < vendors . length && ! window . requestAnimationFrame ; ++ x ) {
184+ window . requestAnimationFrame = window [ vendors [ x ] + 'RequestAnimationFrame' ] ;
185+ window . cancelAnimationFrame = window [ vendors [ x ] + 'CancelAnimationFrame' ]
186+ || window [ vendors [ x ] + 'CancelRequestAnimationFrame' ] ;
187+ }
188+
189+ if ( ! window . requestAnimationFrame )
190+ window . requestAnimationFrame = function ( callback , element ) {
191+ var currTime = new Date ( ) . getTime ( ) ;
192+ var timeToCall = Math . max ( 0 , 16 - ( currTime - lastTime ) ) ;
193+ var id = window . setTimeout ( function ( ) { callback ( currTime + timeToCall ) ; } ,
194+ timeToCall ) ;
195+ lastTime = currTime + timeToCall ;
196+ return id ;
197+ } ;
198+
199+ if ( ! window . cancelAnimationFrame )
200+ window . cancelAnimationFrame = function ( id ) {
201+ clearTimeout ( id ) ;
202+ } ;
203+ } ( ) ) ;
You can’t perform that action at this time.
0 commit comments