Zoltan
Zoltan

Reputation: 163

jQuery setInterval Internet Explorer 8

I am having a problem with jQuery setInterval function in Internet Explorer 8. I have a script which stops the animation from being fired until the previous animation finished. It works fine in Chrome, Firefox and IE 9 as well, but IE 8 the second animation doesn't start. I am also sure the problem is with the Interval, because without it, works fine. See my code below:

 $('#name').animate({top: "325"}, 2000);
 $('#line').animate({width: "525"}, 2000);
 var wait = setInterval(function() {
    if( !$("#line, #name").is(":animated") ) {
       clearInterval(wait);
       $('#photo').fadeIn(2500);
       $('#enter').show(3000);
    }
 }, 0);

Any help appreciated!

Upvotes: 0

Views: 428

Answers (1)

d.k
d.k

Reputation: 4456

I'll suggest to use callback to .animate method

function showItems () {
   $('#photo').fadeIn(2500);
   $('#enter').show(3000);
}
$('#line').animate({width: "525"}, 2000, showItems);

also it seems that problem is not concerning .animate() method and animation. In IE8 i do not see "Enter" link at all. So it is smth with your markup. Try to make a valid XHTML.

Upvotes: 1

Related Questions