Jump to content

Dropdown Menu - Hover Effect


EternalSorrow

Recommended Posts

I'm currently working on a dropdown menu using jquery, and I've run into a snag about how I want it to look.  I'd like the top link of the menu to remain "hovered" even when I browse the lower list.

 

Does anyone know of a way to retain the hover for the top <li> even when the mouse is moving down the row to a sub <ul>?

 

Here's a model for practical reference: link here

 

Here's my simple listing for a part (two of the columns as an example) of the navigation:

<ul class="tabs">
<li><a href="fanfiction">F</a>
<ul class="dropdown">
<li><a href="fanfiction/stories.php?series=Black Blood Brothers">Black Blood Brothers</a>
<li><a href="fanfiction/stories.php?series=Gankutsuou">Gankutsuou</a>
<li><a href="fanfiction/stories.php?series=Hellsing">Hellsing</a>
<li><a href="fanfiction/stories.php?series=Inuyasha">Inuyasha</a>
<li><a href="fanfiction/stories.php?series=Rurouni Kenshin">Rurouni Kenshin</a>
<li><a href="fanfiction/stories.php?series=Trigun">Trigun</a>
</ul>
</li>

<li><a href="design">D</a>
<ul class="dropdown">
<li><a href="design/type.php?type=Divider">Dividers</a></li>
<li><a href="design/type.php?type=Table">Tables</a></li>
<li><a href="design/type.php?type=Iframe">Iframes</a></li>
</ul>
</li>
</ul>

 

And here's the CSS for the dropdown:

ul.tabs
{
display: table;
margin: 0;
padding: 0;
list-style: none;
position: relative;
}

ul.tabs li
{
list-style: none;
display: table-cell;
float: left;
position: relative;
text-align: center;
width: 117px;
font-size: 20px;
font-weight: bold;
padding: 2px 0px 0px 1px;
line-height: 40px;
}

ul.tabs a
{
position: relative;
display: block;
}

ul.tabs a:hover { background: url(images/navhover.png) top center no-repeat; }

/* dropdowns
*************************/

ul.dropdown
{
margin: 0px
padding: 0px;
display: block;
position: absolute;
z-index: 999;
width: 116px;
display: none;
background: url(images/lowernavhover.jpg) top center no-repeat;
background-color: #ccc;
}

ul.dropdown li
{
margin: 3px;
padding: 0;
float: none;
position: relative;
list-style: none;
display: block;
font-size: 12px;
font-weight: normal;
text-align: left;
text-indent: 3px;
width: 116px;
line-height: 18px;
}

ul.dropdown li a
{
display: block;
}

ul.dropdown a:hover { background: none; }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.