JQuery delay()-function breaks loop?

Posted by Rakward on Stack Overflow See other posts from Stack Overflow or by Rakward
Published on 2010-04-24T18:54:27Z Indexed on 2010/04/24 19:03 UTC
Read the original article Hit count: 240

Filed under:
|
|
|

I'm trying to fade an element in and out, but with a slight pause in between, it works without the pause, but when I add the pause using the jQuery delay()-function, it just stops;

Here's the code:

$('#headerimage2').each(function(){
for(i=1;i<50;i++){
    $(this).fadeOut(1200).delay(1000).fadeIn(1000).delay(1000);
    }
});

Why does the delay()-function (both first and second) break the loop?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about delay