vdegenne
vdegenne

Reputation: 13270

using time for a drop-down menu

here's the page,

I'm trying to delay the drop-down menu so the user has few seconds to mousover it cause there's space between the element which triggers the menu and the menu itself.

$("#menu").hover(
    function(){ $("#dropdown").fadeIn(); },
    function(){ $("#dropdown").fadeOut(); }}
);

This works fine but when I mouseover the menu it wears off, my purpose is to make time for the user to put the cursor over it and that it remains present. well what's the best way to do that in jquery ?

Upvotes: 0

Views: 448

Answers (3)

Kanishka Panamaldeniya
Kanishka Panamaldeniya

Reputation: 17576

you can use

$("#dropdown").delay(1000).fadeOut(1000);

this will pauses for 1000 milliseconds before fading in for 1000 milliseconds

Upvotes: 0

Dave Ward
Dave Ward

Reputation: 60580

The hoverIntent plugin helps with that: http://cherne.net/brian/resources/jquery.hoverIntent.html

Upvotes: 1

James Allardice
James Allardice

Reputation: 165971

If what you're asking for is a way to delay the the fadeOut, then you can use the jQuery delay function:

$("#dropdown").delay(1000).fadeOut();

That will delay the fade by 1 second.

Upvotes: 0

Related Questions