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

  • SEARCH
  • Home
  • 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 6254351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:09:55+00:00 2026-05-24T14:09:55+00:00

I was following a dropdown menu tutorial: http://net.tutsplus.com/tutorials/html-css-techniques/how-to-create-a-drop-down-nav-menu-with-html5-css3-and-jquery/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:%20nettuts%20(NETTUTS)&utm_content=Netvibes What I really want to do

  • 0

I was following a dropdown menu tutorial:

http://net.tutsplus.com/tutorials/html-css-techniques/how-to-create-a-drop-down-nav-menu-with-html5-css3-and-jquery/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:%20nettuts%20(NETTUTS)&utm_content=Netvibes

What I really want to do is something like that, but to be able to make it so that when a user clicks on an item in the dropdown, then what the user clicked on is highlighted and even when the user moves the mouse away, the item the dropdown stays there and does not collapse to help give the user a frame of reference as to what page they are at. If the user selects another option in dropdown, then the previous one that the user clicked returns to normal and the new item the user clicked on gets highlighted.

How do I accomplish this either with jquery, javascript, or is there a way just with CSS3 and HTML5?

  • 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-24T14:09:55+00:00Added an answer on May 24, 2026 at 2:09 pm

    If I understand you correctly you would like the following to happen:

    1. First page loads, all drop down menus are collapsed.
    2. User hovers over a menu item, drop-down sub menu appears
    3. User hovers over sub menu item, it is highlighted.
    4. User clicks sub menu item – page reloads. On new page drop-down sub-menu is still visible with the active item highlighted.
    5. User does steps 1-4 again for different sub-menu item, when page reloads previous sub-menu is collapsed, but new sub-menu will be visible.

    The main question here is whether the page will be reloading whenever the user clicks on an item, because the solution will be different depending on that.

    Assuming the page will be reloading then you will need to make it so that when you page reloads the mark-up looks like this:

    <nav id="topNav">
        <ul>
            <li><a href="#" title="Nav Link 1">Nav Link 1</a></li>
            <li class="currentParent"><a href="#" title="Nav Link 1">Nav Link 2</a>
                <ul>
                    <li><a href="#" title="Sub Nav Link 1">Sub Nav Link 1</a></li>
                    <li class="current"><a href="#" title="Sub Nav Link 2">Sub Nav Link 2</a></li>
                    <li><a href="#" title="Sub Nav Link 3">Sub Nav Link 3</a></li>
                    <li><a href="#" title="Sub Nav Link 4">Sub Nav Link 4</a></li>
                    <li class="last"><a href="#" title="Sub Nav Link 5">Sub Nav Link 5</a></li>
                </ul>        
            </li>
          <li><a href="#" title="Nav Link 1">Nav Link 3</a></li>
          <li><a href="#" title="Nav Link 1">Nav Link 4</a></li>
          <li class="last"><a href="#" title="Nav Link 1">Nav Link 5</a></li>
      </ul>
    </nav>
    

    And you’ll need to change the CSS:

    nav ul ul a:hover { background-color:#555; }
    

    to:

    nav ul ul a:hover, nav ul ul li.current a:hover { background-color:#555; }
    

    and:

    .no-cssgradients nav li:hover, .no-js nav li:hover { ... }
    

    to:

    .no-cssgradients nav li:hover, .no-cssgradients nav li.currentParent, .no-js nav li:hover, .no-js nav li.currentParent { ... }
    

    And add the following line:

    nav ul li.currentParent ul { display:block; }
    

    And then in the JavaScript change:

    //show subnav on hover
    $(this).mouseenter(function() {
        $(this).find("ul").stop(true, true).slideDown();
    });
    
    //hide submenus on exit
    $(this).mouseleave(function() {
        $(this).find("ul").stop(true, true).slideUp();
    });
    

    to:

    //show subnav on hover
    $(this).mouseenter(function() {
        if(!$(this).hasClass('currentParent')) {
            $(this).find("ul").stop(true, true).slideDown();
        }
    });
    
    //hide submenus on exit
    $(this).mouseleave(function() {
        if(!$(this).hasClass('currentParent')) {
            $(this).find("ul").stop(true, true).slideUp();
        }
    });
    

    I haven’t actually tested it out, so I’m sure you’ll have to do more than this to get a perfectly working solution, but I hope you can see the sort of thing I’m trying to do here.

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

Sidebar

Related Questions

The following function gets the target element in a dropdown menu: function getTarget(evt){ var
I am using a plugin to create a real slick jquery select (dropdown) menu.
the following js works fine in FF2 but in IE6 the dropdown always selects
Given the following HTML: <select name=my_dropdown id=my_dropdown> <option value=1>displayed text 1</option> </select> How do
Following my question regarding a .NET YAML Library ... as there doesn't seem to
Following techniques from 'Modern C++ Design', I am implementing a persistence library with various
To give some context, the following dropdown is within a form that gives the
I have this dropdown (select) menu generated with JQuery, dynamically using JSON coming from
Following on from my recent question on Large, Complex Objects as a Web Service
Following this question: Good crash reporting library in c# Is there any library like

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.