Created
November 1, 2012 20:57
-
-
Save TastyToast/3996489 to your computer and use it in GitHub Desktop.
Fade images in sequentially
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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); | |
})(); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment