Skip to content

Commit

Permalink
Fixed bug with cancelAnimationFrame not getting vendor specific prefi…
Browse files Browse the repository at this point in the history
…x, and only not checking if cancelAnimationFrame existed alongside requestAnimationFrame.
  • Loading branch information
wimbarelds committed Apr 21, 2014
1 parent d39931d commit 90763f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions inc/TimeCircles.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@
var vendors = ['webkit', 'moz'];
for(var x = 0; x < vendors.length && !window.top.requestAnimationFrame; ++x) {
window.top.requestAnimationFrame = window.top[vendors[x]+'RequestAnimationFrame'];
window.top.cancelAnimationFrame = window.top[vendors[x]+'CancelAnimationFrame'];
}
if (!window.top.requestAnimationFrame) {

if (!window.top.requestAnimationFrame || !window.top.cancelAnimationFrame) {
window.top.requestAnimationFrame = function(callback, element, instance) {
if(typeof instance === "undefined") instance = { data: { last_frame: 0 } };
var currTime = new Date().getTime();
Expand All @@ -176,7 +178,7 @@
};
window.top.cancelAnimationFrame = function(id) {
clearTimeout(id);
}
};
}
})();

Expand Down

0 comments on commit 90763f8

Please sign in to comment.