How to show div for 10 seconds and then hide it
$("#div1").mouseenter(function() {
var $div2 = $("#div2");
if ($div2.is(":visible")) { return; }
$div2.show();
setTimeout(function() {
$div2.hide();
}, 10000);
});
Another way to go:
$("#div1").mouseenter(function() {
var $div2 = $("#div2");
if ($div2.data("active")) { return; }
$div2.show().data("active", true);
setTimeout(function() {
$div2.hide().data("active", false);
}, 10000);
});
Use jQuery's delay(n); method http://api.jquery.com/delay/
$(function() {
$("#div1 img").hover(function(){
$("#div2").show().delay( 10000 ).hide(0);
});
});