I have a series of elements that I want to toggle in-and-out of view sequentially. I am using a <button class="toggle">
to control this:
$('.toggle').click(function(){
$('.squares span').each(function(index){
$(this).delay(600*index+1).toggleClass('hide');
});
});
jsFiddle: http://jsfiddle.net/r2vk7L5b/
It appears that the delay()
method is simply being ignored in this loop. The index
variable is being passed as expected as well. You can console out to see it returning as 0,1,2,3, etc.
What here am I failing to understand about the each()
or delay()
method?