Example #17: scheduling different elements' animations
Here we use an instant repeat-loop together with a sequential each-loop.
In each iteration step we wait until the element is completely shifted up using .animate({opacity:0,top:-50},$)
.
Then the next animation is queued with .animate({opacity:1,top:0})
, which shifts the element down again but without waiting.
The loop starts its next iteration, now using the next element.
So we have one element going up and another element going down simultaneously.
As you see the usage of $ as token in place of the animate callback handler decides about whether to wait for the animation to finish.
⇒
A
B
C
D
E
Other examples with animations
Other examples with each-loops
Other examples with instant loops
- Example #2: repeated blinking with iterated timeouts
- Example #4: blinking a given number of times on click
- Example #5: create dynamic tables with instant loops
- Example #6: iterate all selected elements with a timeout
- Example #8: simple progress indicator with text
- Example #12: cyclic button clicks
- Example #15: enable continue button only after making choices
- Example #16: playing pong with divs
- Example #18: falling little boxes
- Example #20: ruler with animation
Other examples with open loops
- Example #1: repeated blinking (like in the old days with the deprecated
<blink>
element) - Example #2: repeated blinking with iterated timeouts
- Example #6: iterate all selected elements with a timeout
- Example #7: clock display with one short blink per second
- Example #8: simple progress indicator with text
- Example #14: wait a timeout after each click before blinking
- Example #16: playing pong with divs
- Example #19: pause animation cycle on mouseover
- Example #20: ruler with animation
Other examples with repeat-loops
- Example #1: repeated blinking (like in the old days with the deprecated
<blink>
element) - Example #2: repeated blinking with iterated timeouts
- Example #4: blinking a given number of times on click
- Example #5: create dynamic tables with instant loops
- Example #6: iterate all selected elements with a timeout
- Example #7: clock display with one short blink per second
- Example #8: simple progress indicator with text
- Example #9: generating password with fake progress
- Example #11: change the banner randomly in an interval loop
- Example #12: cyclic button clicks
- Example #14: wait a timeout after each click before blinking
- Example #16: playing pong with divs
- Example #18: falling little boxes
- Example #20: ruler with animation