Skip to content

Instantly share code, notes, and snippets.

@frace
Created May 28, 2013 13:34
Show Gist options
  • Select an option

  • Save frace/5662790 to your computer and use it in GitHub Desktop.

Select an option

Save frace/5662790 to your computer and use it in GitHub Desktop.
A chainable jquery function to fade in a number of elements one after another.
/**
* A chainable function to fade in a number of elements one
* after another.
*
* @param {Object} timing
*
*/
$.fn.leVader = function( timing ) {
this.each(function( index ) {
$( this ).delay( index * timing.delay ).fadeIn( timing.duration );
});
};
// Example
var timings = {
delay : 10,
duration: 100
};
$( "li" )
.hide()
.stop()
.leVader( timings );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment