I have an animation where I'm not sure what's going wrong. My fadeIn/Out delays are not respected. I am attempting to fade out a tile, replace it with a new tile and fade it in. This is done 4 times in this case but it could vary thus the for loop.
Here is a shortened version of my code. On a click action, 4 tiles are replaced by new tiles but there are no delays in the animation, even at 2000.
for (var i = 0; i < animation.length; i++) {
animation[i]['old']
.animate({ opacity: 0 }, {
duration: 500,
queue: function () {
jQuery(this)
.replaceWith(self.template(animation[i]['new']))
.css({ opacity: 0 })
.animate({ opacity: 100 }, 2000);
}
});
}