Return to Snippet

Revision: 37691
at December 15, 2010 07:49 by alyssonweb

Initial Code
// Wrapping, self invoking function prevents globals
(function() {
   // Hide the elements initially
   var lis = $('li').hide();

   // When some anchor tag is clicked. (Being super generic here)
   $('a').click(function() {
      var i = 0;

      // FadeIn each list item over 200 ms, and,
      // when finished, recursively call displayImages.
      // When eq(i) refers to an element that does not exist,
      // jQuery will return an empty object, and not continue
      // to fadeIn.
      (function displayImages() {
         lis.eq(i++).fadeIn(200, displayImages);

Initial URL

Initial Description

Initial Title
Display Elements Sequentially with jQuery

Initial Tags

Initial Language