performance - How to change fade InOut timing in jQuery? -
below jquery fade in , out list items sequentially. code makes list items fade in , out fast. how control speed?
function inout( elem ) { elem.delay() .fadein() .delay() .fadeout( function(){ if(elem.next().length > 0) {inout( elem.next() );} else {inout( elem.siblings(':first'));} } ); } $(function(){ $('#content li').hide(); inout( $('#content li:first')); });
thanks help.
angela
you pass in number in milliseconds fadein
fadeout
functions.
fadein(300); // 300 milliseconds fade in fadeout(1000); // 1 second fade out
in case like;
function inout( elem, fadein, fadeout ) { elem.delay() .fadein(fadein) .delay() .fadeout(fadeout, function(){ if(elem.next().length > 0) {inout( elem.next(), fadein, fadeout );} else {inout( elem.siblings(':first'), fadein, fadeout);} } ); } $(function(){ $('#content li').hide(); inout( $('#content li:first'), 1000, 1000); });
Comments
Post a Comment