Skip to content

Instantly share code, notes, and snippets.

@rupert-ong
Created April 24, 2012 18:09
Show Gist options
  • Save rupert-ong/2482187 to your computer and use it in GitHub Desktop.
Save rupert-ong/2482187 to your computer and use it in GitHub Desktop.
jQuery: Fade In Object One by One
$.fn.fade1by1 = function(options) {
var opt = $.extend({
'delay': 500,
'speed': 500,
'ease': 'linear'
}, options);
var that = this;
for (var i = 0, d = 0, l = that.length; i < l; i++, d += opt.delay) {
that.eq(i).delay(d).fadeIn(opt.speed, opt.ease);
}
};
// Example
$('#images img').fade1by1({ speed: 400, delay: 200 });​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment