(function ($){ var animating, lastTime = 0, vendors = ['ms', 'moz', 'webkit', 'o'] , requestAnimationFrame = window.requestAnimationFrame, cancelAnimationFrame = window.cancelAnimationFrame; for (; lastTime < _AN_Read_length('length', vendors) && !requestAnimationFrame; lastTime++ ){ requestAnimationFrame = window[vendors[lastTime] + "RequestAnimationFrame"]; cancelAnimationFrame = cancelAnimationFrame || window[vendors[lastTime] + "CancelAnimationFrame"] || window[vendors[lastTime] + "CancelRequestAnimationFrame"]; } function raf(){ if (animating) { requestAnimationFrame(raf); jQuery.fx.tick(); } } if (requestAnimationFrame) { window.requestAnimationFrame = requestAnimationFrame; window.cancelAnimationFrame = cancelAnimationFrame; jQuery.fx.timer = function (timer){ if (timer() && jQuery.timers.push(timer) && !animating) { animating = true ; raf(); } } ; jQuery.fx.stop = function (){ animating = false ; } ; } else { window.requestAnimationFrame = function (callback, element){ var currTime = new Date().getTime(), timeToCall = Math.max(0, 16 - (currTime - lastTime)), id = _AN_Call_settimeout("setTimeout", window, function (){ callback(currTime + timeToCall); } , timeToCall); lastTime = currTime + timeToCall; return id; } ; window.cancelAnimationFrame = function (id){ clearTimeout(id); } ; } } (jQuery));