jquery - mouseenter wait a bit then display the div item (in seconds?) -
i'm trying accomplish user hovers on item , jquery takes on , displays item (but after few seconds). i've got following html listed:
<ul id="ulpersonal"> <li class="break etime"> <p>manage time card.</p> <div id="detime"> content </div> </li> </ul>
the li item visible, , once mouseenter
show div detime
shown (here jquery):
$('#detime').hide(); $(".etime").mouseenter(function () { $('#detime').fadein('slow'); });
this works great..when user hovers on li
item div fades in. however, want wait 2-3 seconds before happens. meaning allow user hover on li, should wait , open if still hovering more 2 seconds. if "un-hover" before 2 seconds div should never appear.
i hope makes sense. allow hover display div once 2 seconds up. otherwise dont display it. i've got lot of div's need hoping keep simple now.
try hover
+ settimeout
var id; $('#detime').hide(); $(".etime").hover( function () { id = settimeout(function(){ $('#detime').fadein('slow'); }, 2000) }, function() { if (id != null) { clearinterval(id); } $('#detime').fadeout('slow'); } );
Comments
Post a Comment