The title explains the question, otherwise is there way to call a function when all the effects on a page are done running?
+2
A:
You might be able to make use of .queue to get the functionality you are after. If the length of the queue was 0 you would know that all animations on the object are finished.
Corey Downie
2009-01-20 19:52:41
that is close, though I was hoping for a way to do this without changing the existing effects.
2009-01-20 19:57:08
I haven't seen your code, but my understanding is that the queue gets populated for any object running an animation. I don't expect there would be big changes to your code in order to query the queue array.
Corey Downie
2009-01-20 20:06:39
+3
A:
You could nest your animations like this
$('#Div1').slideDown('fast', function(){
$('#Div2').slideUp('fast');
});
And do them sequentially...
You could also do something like this:
var animations = 0;
checkAnimation(1);
$('#Div1').slideDown('fast', function(){
checkAnimation(-1);
});
checkAnimation(count){
animations += count;
if(count == 0)
//animations complete
}
else {
//still animating
}
}
Hope this helps.
Birk
2009-01-20 19:52:41