/ Published in: jQuery
http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-display-elements-sequentially-with-jquery/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// 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); })(); }); })();