/*
* BCDC.US - fadein images sequentially jQuery plugin
* Examples and documentation at: http://bcdc.us
* Version: 2.0 ( Mar-11-2010 )
* Copyright (c) 2009 Bruno Correia
* Requires: jQuery v1.3+
*/
(function($) {
$.fn.fadeflow = function(customOptions) {
var options = $.extend({},$.fn.fadeflow.defaultOptions, customOptions);
$this = $(this).children(options.element);
if ( options.opacity > 0 ) {
$this.hide(); // hide all
if not declared on the CSS
}
var fades = $this,
n = $this.length,
i = 0;
setTimeout(function() {
$(fades[i++] || []).fadeTo(options.speed, options.opacity, arguments.callee); // keep || [] for jquery 1.3 and older
if ( i > n ) {
options.onComplete(); // do something
}
},options.fadeAfter);
};
$.fn.fadeflow.defaultOptions = {
opacity: 1.0, // if zero, fadeOut. Bigger than zero fadeIn.
speed: 400, // speed in milliseconds
element: 'img', // html tag
fadeAfter: 1000, // time delay in milliseconds
onComplete: function() { /* do something */ }
};
})(jQuery);