Example #14: wait a timeout after each click before blinking

With the concatenation of two .wait()s we achieve a single short blink.

Instead of attaching an event handler explicitly we start an infinite event loop for the "click" event. Repeat loops are always sequential, i.e. the next iteration can start only if the previous one ended. You can see this behavior when double- or triple-clicking the button.

$('.example button').repeat('click').prev()
   .wait(500).addClass('blink')
   .wait(300).removeClass('blink');

That text blinks half a second after hitting .

Other examples with inline attached events

Other examples with open loops

Other examples with repeat-loops

Other examples with timeouts