On Oct 25, 10:21 am, Snooze <[EMAIL PROTECTED]> wrote:
> Hi, I have hidden text that appears whenever someone hovers over an
> image in my table. And I want it to disappear 5 seconds after they
> stop hovering over the image.
Here's my untested attempt:
$(document).ready(function(){
$('div.hidden').hide();
$('img.hidden').hover(function(){
clearTImeout(this._hider_);
$(this).next('div.hidden').show();
}, function(){
var elem = this;
this._hider_ = setTimeout(function(){
$(elem).next('div.hidden').hide();
}, 5000);
});
});
In case I messed something up, the problem I was trying to solve here
with setTimeout/clearTimeout is that you don't want a delayed hide
event to kick in if you mouse back over the same element.
It might be possible to do this more elegantly with
the .pause()/.unpause() plugin and effects.