/    Sign up×
Community /Pin to ProfileBookmark

onMouseout delay for div menu box?

I want to make my drop down box similar to the one seen at [url]http://www.gamewearteamsports.com/[/url]

The menu links act as normal links but will drop down to a div box when a person hovers over the link. The box will appear when the person hovers it but SHOULD disappear once the person does not hover over the box anymore. So if the person hovers over another link, the box should disappear. I added a delay timeout to one of my div boxes and the box stays alive for a couple of seconds but then closes back up again even though I’m still hovering over it. Any ideas?

My js:

[CODE]<script type=”text/javascript”>
function drop(which)
{
document.getElementById(“drop” + which).style.display = “block”;
}
function undrop(which)
{
document.getElementById(“drop” + which).style.display = “none”;
}

</script>[/CODE]

My menu links code:

[CODE]<ul id=”head1″ style=”width:940px;”>
<li><a href=”#” onmouseover=”drop(1)”>Basketball</a></li>
<li><a href=”#” onmouseover=”drop(2)” onmouseout=”undrop(2)”>Football</a></li>
<li><a href=”#” onmouseover=”drop(3)” onmouseout=”undrop(3)”>Volleyball</a></li>
<li><a href=”#” onmouseover=”drop(4)” onmouseout=”undrop(4)”>Soccer</a></li>
<li><a href=”#” onmouseover=”drop(5)” onmouseout=”undrop(5)”>Baseball</a></li>
<li><a href=”#” onmouseover=”drop(6)” onmouseout=”undrop(6)”>Hockey</a></li>
<li><a href=”#” onmouseover=”drop(7)” onmouseout=”undrop(7)”>Training</a></li>[/CODE]

The code I have for the first link:

[CODE] <div id=”drop1″ onmouseout=”setTimeout(‘undrop(‘1′)’, 3000);” style=”z-index:3000;”>[/CODE]

There’s a table with content in it inside the div. There’s a </ul> tag that closes out the menu links.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @compwiz02 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...