$("#banner ul li").each(function(i){
$(this).animate({
width: arrW[index],
height: arrH[index],
opacity: arrO[index],
left: arrL[index],
top: arrT[index]
},500)
}
What I don’t understand is that when each loop is performed, the execution of the animation takes 500ms. Does that mean that the next loop will be started after the animation execution ends, that is, 500 milliseconds? Or do you wait for the animation to finish executing before executing the next cycle?
Each is mainly just traversal, there is no asynchronous call operation, while animate's animation mainly uses delay, which is asynchronous.
http://www.zhangyunling.com/2...
This is like:
So, the animation callback should enter the task queue, so the loop is executed first.
The binding events should be looped first and then done at the same time.
In other words, before the animation is executed, a loop is first made and the animation is bound to each element. After the loop ends, all elements undergo this animation at the same time.