jQuery setTimeout fadeOut() fadeIn() show() hide() example

This is a bit of craziness, still it works nicely to hide a element, show another, and then a bit later hide the latter, and again show the original.

$(‘#item1’).bind(‘click’,function() {

$(‘#item1’).fadeOut( function(){

setTimeout( function(){

$(‘#item2’).fadeIn(function() {

setTimeout( function(){

$(‘#item2’).fadeOut(function(){

setTimeout( function() {

$(‘#item1’).fadeIn();

}, 100);

});

}, 2000 );

});

}, 100);

}); return false;

});

Comments are closed.