Search code examples
jquerydelayfadeinfadeout

JQuery delay()-function breaks loop?


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 after the first fadeOut();

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?


Solution

  • Shot in the dark here, but are you sure you're using version 1.4 of the library. This is a new function as of that version.