got this problem were i need this function to work as a loop (or atleast i think thats what I want).
It works the first time I enter #nav and leave but the second time I want to enter the navigation the addClass function is not working.
$("#nav").mouseenter(function() {
$(".desktop a").delay(300).queue(function(){$(this).addClass('showhidden')});
});
$("#nav").mouseleave(function() {
$(".desktop a").removeClass("showhidden");
});
You need to dequeue it:
$(".desktop a").dequeue().delay(300).queue(function(){$(this).addClass('showhidden')});
And:
$(".desktop a").dequeue().removeClass("showhidden");
Or just use:
$(".desktop a").clearQueue().removeClass("showhidden");
Remove Class
setTimeout(function() {
elements.removeClass(className);
}, 4000);
Add Class
setTimeout(function() {
elements.attr('class','classname');
}, 4000);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.