I want to delay an animation that slides an image in a li a-element. I had the idea, that I could go through every li element with a counter (i) and set a timeout with the animation to do: 1000 + i * 50
Unfortunately only the last li-element will be animated. Why is that?
li = $('nav ul li').get();
lic = li.length;
$('nav ul li a .icon').hide();
t = [];
for (i = 0; i < li.length; i++) {
var obj = $('nav ul li')[i];
t[i] = setTimeout(function() {
$(obj).children('a').children('.icon').slideDown();
}, 1000 + i * 50);
delete obj;
}
delete objwill not do anything becausedeletewill only remove properties, not variables.