javascript - Add class with delay JQuery then remove and loop this function -


got problem need function work loop (or atleast think thats want).

it works first time enter #nav , leave second time want enter navigation addclass function not working.

$("#nav").mouseenter(function() {     $(".desktop a").delay(300).queue(function(){$(this).addclass('showhidden')}); }); $("#nav").mouseleave(function() {     $(".desktop a").removeclass("showhidden"); }); 

you need dequeue it:

$(".desktop a").dequeue().delay(300).queue(function(){$(this).addclass('showhidden')}); 

and:

$(".desktop a").dequeue().removeclass("showhidden"); 

or use:

 $(".desktop a").clearqueue().removeclass("showhidden"); 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -