jquery - dropdown close after 10 seconds -
i have problem.
$(function () { $('.drop-down').click(function(e){ $('.nav-fixed').toggleclass('open'); e.stoppropagation(); }); });
i want when mouseout #nav.nav-fixed.open nav close after 10 seconds
try
$(function () { $('.drop-down').click(function(e){ cleartimeout($(this).data('cleartimer')) $('.nav-fixed').toggleclass('open'); e.stoppropagation(); }); $('.drop-down').mouseleave(function(){ var id = settimeout(function(){ $('.nav-fixed').removeclass('open'); }, 10000); $(this).data('cleartimer', id); }) });
demo: fiddle
Comments
Post a Comment