As Sergio said, you can use the index in the iteration for a cascading effect.
(function(){
// don't always lookup through DOM, cache el references if they are
// not changing dynamically
var checks = $$('.check'),
index = 3;
// ...
if (index === 3){
checks.each(function(el, i){
// i truthy is enough.
i && checks[i-1].addClass('hide');
// use a 100ms incremental delay for each next el
this.delay(i*100, el, 'hide');
}, Element.prototype.removeClass);
}
}());
the Function.prototype.delay
can be applied on Element.prototype.removeClass
(used as context for fun).
keep in mind that the above is broken - we can't see all your code or the intent behind it. delaying the applied removeClass
will work but it will undo the addClass('hide')
later so you'd end up with all elements visible.