如何父元素等到孩子的停止动画()

问题描述:

我有一堆LI元素动画(了slideDown)内的UL。李后完成自己的动画我想补充以下UL A-HREF元素。

I got bunch of LI elements animating (slideDown) inside UL. After LI finish their animation I want to add A-HREF element below UL.

有一个问题 - 如果我用

There is a problem - if I use

$('li').animate(SPEED, callback)

等待LIS完成其动画,我的回调将被称为n次(N =算LI) - 如果我有20 LIS,20 A-的HREF将波纹管加入UL。我需要onlt一个A HREF,在换句话说,我需要等待,直到完成LI他们的动画,然后火一把回调。

to wait for LIs finish its animation, my callback will be called n-times (n = count LI) - if I have 20 LIs, 20 A-HREFs will be added bellow UL. I need onlt one A-HREF, in the other words, I need to wait, until LI finish theirs animation and then fire ONE callback.

任何想法?

尝试,

$('li').animate(SPEED, callback);

callback = function(){
   if ($(this).siblings(':animated').length < 1) { // check if other li's are still animating...
      // do parent animation or anything here...
   }
}