jQuery.fn.hideshow = function(delay) { id = this; if (!delay){delay = 3000;} return this.each(function(){ setTimeout(function(){ jQuery(id).animate({opacity:0},2000);} ,delay); jQuery(id).hover(function(){jQuery(this).animate({opacity: 1},500);}, function(){jQuery(this).animate({opacity:0},1000);});}); };