[jQuery] Queueing animation effects
I need to be able to do a number of animation effects on a page, but
the various classes have to occur one after the other, not all at
once. For example:
$('.hidden).show ('slow');
$('shown').hide ('slow');
is no good.
I tried firing one as a callback to the other, which worked fairly
well
$('.hidden).show ('slow', function ()
{
$('shown').hide ('slow');
});
but this had a problem, in that if nothing matches .hidden, then the
show animation never gets executed.
What I need is some kind of animation queue, where effects get stacked
up one after the other, the next one only starting when the previous
one completes. If any effect in the queue doesn't happen then I still
need the subsequent items to be executed.
Does anyone know how I could do this?