首页 > 代码库 > JS适配问题。

JS适配问题。

动画requestAnimFrame + cancelAnimationFrame

window.requestAnimFrame = (function(){    return  window.requestAnimationFrame ||        window.webkitRequestAnimationFrame ||        window.mozRequestAnimationFrame    ||        window.oRequestAnimationFrame      ||        window.msRequestAnimationFrame     ||        function( callback ){          window.setTimeout(callback, 1000 / 60);        };})();window.cancelAnimationFrame =(function(){    return window.cancelAnimationFrame ||        window.cancelRequestAnimationFrame ||        window.webkitCancelAnimationFrame ||         window.webkitCancelRequestAnimationFrame ||        window.mozCancelAnimationFrame ||         window.mozCancelRequestAnimationFrame ||        window.msCancelAnimationFrame ||         window.msCancelRequestAnimationFrame ||        window.oCancelAnimationFrame ||         window.oCancelRequestAnimationFrame ||        window.clearTimeout;})();

 

JS适配问题。