Example #11: change the banner randomly in an interval loop
Given that you have a method which selects any element from the current jQuery set randomly,e.g. ,
then you can use that to build a banner rotator very easily.
In this example there are four different banners. Every 5 seconds another one fades in, randomly chosen.
As we don't want to wait for the animations finishing we use the original version of .fadeIn() and .fadeOut() here.
⇒Some banner text?
some more text here
Some other cool stuff?
this is other text
Even different text
this is new text
Attention!
cheaper, cheaper, cheaper…
Other examples with animations
Other examples with closed loops
- Example #4: blinking a given number of times on click
- Example #5: create dynamic tables with instant loops
- Example #8: simple progress indicator with text
- Example #9: generating password with fake progress
- Example #12: cyclic button clicks
- Example #15: enable continue button only after making choices
- Example #18: falling little boxes
- Example #20: ruler with animation
Other examples with intervals
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 #12: cyclic button clicks
- Example #14: wait a timeout after each click before blinking
- Example #16: playing pong with divs
- Example #17: scheduling different elements' animations
- Example #18: falling little boxes
- Example #20: ruler with animation