Check out this code, I'm using it to show a popup (#add_popup) and
fade out if the mousepointer is out for more than 1 second.
At the moment it's just a Quick&Ditry hack. Just to give you a clue.
$("div").dblclick(function(ev){
timer = $("#add_popup").data("popup-timer");
if (timer) {
clearTimeout(timer);
$("#add_popup")
.stop()
.css('opacity', 1)
.data("popup-timer",0);
}
$("#add_popup")
.show()
.css({'top': ev.pageY-40, 'left': ev.pageX-10})
.data("popup-timer", 0)
.bind("mouseleave", function(ev){
var timer = $(this).data("popup-timer");
if (timer)
clearTimeout(timer);
timer = setTimeout( function(){
$("#add_popup").fadeOut("slow");
}, 1000);
$(this).data("popup-timer", timer);
})
.bind("mouseenter", function(ev){
var timer = $(this).data("popup-timer");
if (timer)
clearTimeout(timer);
$(this)
.stop()
.css('opacity', 1)
.data("popup-timer", 0);
});
});