I am trying number counter animation for displaying the value of an element and setTimeout() works as the specified time in firefox but for some reason in IE it is invoked quickly.
The below is my code..
$('document').ready(function() {
var i=1,data=10;
my_int=setInterval(
function () {
if(i<=data)
$('p').text(i++);
else
$('body').append("overflow"); }
,64);
setTimeout(function() { $('body').append("done");clearInterval(my_int); },64*data);
});
By quickly I mean in IE setInterval() is executed 8 times and then it is invoking the timeout function (while it should loop for 10 times).
I have also gone through these question but none of them helped. one two
is it a problem in IE or is it problem with my code itself ??