jQuery动画的多个元素的回调
正如您在此小提琴中看到的那样,我一次对多个元素进行了动画处理,
这是我所希望的.但是在下一步中,我想在所有元素的动画结束后再做一次.使用完成功能似乎无法实现,因为它是为每个完成的动画触发的(3个元素,完成回调的3倍). jQuery .animate()
API也说:
As you can see at this Fiddle, I animate more than one element at once,
which is happening as I wish. But in the next step, I would like to do things ONCE the animation for all elements is over. Which does not seem to be possible by using the complete-function, because it is it fired for EACH completed animation (3 elemets, 3 times complete callback). the jquery .animate()
API also says:
如果对多个元素进行了动画处理,则对每个匹配的元素执行一次回调,而不对整个动画执行一次.
If multiple elements are animated, the callback is executed once per matched element, not once for the animation as a whole.
那么,您是否知道在完成每一个动画后都会触发一个事件该怎么办?
So, do you have any idea what I can do to have an event fired when every single animation has finished?
...animate(...).promise().done(function(){console.log("animate complete!")})