Hold-Hover drop down menu Delay Time

Tag: menu , hover , drop-down-menu , delay Author: zs_zheng123 Date: 2011-09-04

Im creating a drop down menu and i want to know if there is anyway to implement the following:

I need to keep the sub-menu open for like 1 sec if the user moves the mouse away from the tab he selected. Much likely like in current intel web page www.intel.com , here u hover over menu, but if u take the mouse away from the tab or the sub-menu is opens it takes a few to hide the sub menu.

Im using .mouseover from jquery to show the menu (a div) but i cant find a way to make it stay for a few moments.

Thanks in advance

I met the similar question, you could find out the answer [here][1] [1]:

Other Answer1

This may be of service Javascript sleep

If you want to do something in the interim setTimeout() takes the arguments as shown where continue execution is another subroutine. If you just want this one tab to work this way have mouseover call doStuff and set a boolean (e.g. mouseStillIn) to TRUE. When the mouse exits set this boolean to FALSE, call a recursive function everytime mouseStillIn is TRUE.

e.g.


var mouseStillIn : boolean = false;

function MouseIn()
{
mouseStillIn=true;
CheckMouse();
}

function CheckMouse()
{
if(mouseStillIn)
{
setTimeout(CheckMouse, 1000);
}
}

function MouseOut()
{
mouseStillIn=false;
}