Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6915555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:29:24+00:00 2026-05-27T09:29:24+00:00

I have a small problem with a drop-down navigation menu. When hovering over an

  • 0

I have a small problem with a drop-down navigation menu.

When hovering over an item with a submenu, the hover state activates and the submenu drops down correctly. But once you mouse into into the submenu, the original menu item reverts from its hover background color to the original state.

Is there a way to keep the background hover state the same when going into the submenu? To complicate it, each menu item with a submenu is a different color as well.

HTML:

<nav id="topNav"> 
        <ul>
            <li><a href="#" title="About">About</a></li>
            <li id="learn"><a href="#" title="Learn">Learn</a>
                <ul>
                    <li><a href="#" title="News">News</a></li>
                    <li><a href="#" title="Research">Research</a></li>
                    <li><a href="#" title="Simulcasts">Simulcasts</a></li>
                    <li><a href="#" title="Fellowships">Fellowships</a></li>
                    <li><a href="#" title="Internships">Internships</a></li>
                </ul>
            </li>
            <li id="connect"><a href="#" title="Connect">Connect</a>
                <ul>
                    <li><a href="#" title="News">News</a></li>
                    <li><a href="#" title="Research">Research</a></li>
                    <li><a href="#" title="Simulcasts">Simulcasts</a></li>
                    <li><a href="#" title="Fellowships">Fellowships</a></li>
                    <li><a href="#" title="Internships">Internships</a></li>
                </ul>
            </li>
            <li id="invest"><a href="#" title="Invest">Invest</a>
                <ul>
                    <li><a href="#" title="News">News</a></li>
                    <li><a href="#" title="Research">Research</a></li>
                    <li><a href="#" title="Simulcasts">Simulcasts</a></li>
                    <li><a href="#" title="Fellowships">Fellowships</a></li>
                    <li><a href="#" title="Internships">Internships</a></li>
                </ul>
            </li>
        </ul>
    </nav>

JS:

(function($){

$(document).ready(function() {
    //cache nav
    var nav = $("#topNav");

    //add hover animations to submenu parents
    nav.find("li").each(function() {
        if ($(this).find("ul").length > 0) {

            //show subnav on hover
            $(this).mouseenter(function() {
                $(this).find("ul").stop(true, true).slideDown(200);             
            });

            //hide submenus on exit
            $(this).mouseleave(function() {
                $(this).find("ul").stop(true, true).slideUp(50);
            });
        }
    });
});

CSS:

nav { display:block; position:relative; z-index: 600; 
nav ul { padding:0; margin:0; }  
nav li { position:relative; float:left; list-style-type:none; }  
nav ul:after { content:"."; display:block; height:0; clear:both; visibility:hidden; }  
nav li a { display:block; width: 68px; padding: 18px 35px 53px 9px; color:#fff; border-right: 1px solid #D0D2D3; text-decoration:none; }  
nav li a:focus { outline:none; text-decoration:underline; }  
nav a span { display:block; float:rightright; }  
nav a:hover { background-color: #e5e6e7; color: #4D4D4D; }
nav ul ul { display:none; position:absolute; left:0; }  
nav ul ul li { float:none; }  
nav ul ul a { width: 199px; padding:13px; border-right:none; border-bottom: 1px solid #fff; }  
nav ul li:nth-child(2) { background-image: url('../images/nav-turquoise.png'); background-repeat: no-repeat; background-position: top right; } 
nav ul li:nth-child(3) { background-image: url('../images/nav-purple.png'); background-repeat: no-repeat; background-position: top right; }
nav ul li:nth-child(4) { background-image: url('../images/nav-orange.png'); background-repeat: no-repeat; background-position: top right; }
nav ul li:nth-child(2) a:hover { background-color: #14C7C4; color: #4D4D4D; background-image: url('../images/nav-grey.png'); background-repeat: no-repeat; background-position: top right; }
nav ul li:nth-child(3) a:hover { background-color: #A36CC8; color: #4D4D4D; background-image: url('../images/nav-grey.png'); background-repeat: no-repeat; background-position: top right; }
nav ul li:nth-child(4) a:hover { background-color: #FBB600; color: #4D4D4D; background-image: url('../images/nav-grey.png'); background-repeat: no-repeat; background-position: top right; }
#learn ul li { background-color: #14C7C4; background-image: none; }
#connect ul li { background-color: #A36CC8; background-image: none; }
#invest ul li { background-color: #FBB600; background-image: none; }
#learn ul li a:hover { background-color: #27a3a4; color: #fff; background-image: none; }
#connect ul li a:hover { background-color: #865e97; color: #fff; background-image: none; }
#invest ul li a:hover { background-color: #d39b13; color: #fff; background-image: none; }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:29:24+00:00Added an answer on May 27, 2026 at 9:29 am

    I apply my :hover styles to the li instead of the a. Technically, as your menu is nested list items, by hovering over sub-menu items you are still hovering over the parent li and therefore the style will stick.

    Hope that helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small little problem. I am have a drop down list that
Well, I have a really small problem. How can I access an ASP.NET Drop
I have a small problem where I want to find the next active item
have small problem, and would very much appreciate help :) I should convert byte
I have small problem with my .net 2.0 winforms application. I want to embed
I have a small problem with interfaces. Here it is in Pseudo code :
I have a small problem with a script. I want to have a default
I have a small problem with how should i think a... problem. I want
I have a small problem with Smarty... I have two different template files in
i have a small problem, i am creating a edit page in my asp.net

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.