How to know which events slow down setTimeout()
?
In my code I have a keyframe animation of 2 seconds.
I add a class to animate a div
$('#first').addClass('first-start');
and using setTimeout
I add a class to stop the animation only after 1 second.
setTimeout(function() {
$('#first').addClass('first-pause');
}, 1000);
All animation should be of 2 seconds if I don't block it.
I noticed that setTimeout
sometimes not run exactly after 1000 milliseconds.
How can I solve this?
How can I know which events slow down setTimeout
?