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 5998693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:26:32+00:00 2026-05-23T00:26:32+00:00

I put together a simple drop-down navigation that expands when you hover over a

  • 0

I put together a simple drop-down navigation that expands when you hover over a link.

When hovering over a link an absolute positioned div will expand, revealing the sub-navigation. My problem is that this div doesn’t collapse automatically when the mouse leaves the navigation area, and that’s what I need to happen.

I’ve added onMouseover commands to the other links in the navigation that will collapse the div when activated, but the functionality that I really need is for the drop-down div to collapse when the mouse leaves the div area.

I greatly appreciate any help with this.

——EDIT——-

Thanks for the help @Tuanderful. I solved this problem in an inelegant (yet effective) fashion.

I simply added the onmouseover event with a close trigger to the divs immediately below and above the navigation. This way when a user’s cursor leaves the drop-down navigation, the trigger fires and the drop-down closes automatically.

I agree that a pure CSS approach would have been ideal, but due to some other complications with this navigation I had to go with the Javascript solution.

  • 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-23T00:26:33+00:00Added an answer on May 23, 2026 at 12:26 am

    Instead of making #subnav1 a sibling of #nav, you can try make div#subnav1 a nested list; your nav structure would look like:

    <ul>
        <li>About</li>
        <li>Products
            <ul>
                <li>Booster</li>
                ....
            </ul>
        </li>
    </ul>
    

    Then you can use CSS (instead of javascript) to control the hiding and showing of the sub-nav. This can be done with the :hover pseudo-selector.

    The approach is to initially hide the submenu with

    ul ul { display: none }

    When the user mouse’s over the main menu’s items, use the :hover selector to display the sub-menu

    li:hover ul { display: block }

    If you decide to change the HTML structure you may need to continue to refine your CSS/images appropriately for everything to fall into place.

    A good resource that goes into this approach in further detail can be found at A List Apart: Horizontal DropDowns. An even more robust example (and slightly different approach) can be found at this CSS Wizardry article on Creating a Pure CSS Dropdown Menu

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

Sidebar

Related Questions

I put together a simple system so that my dad can manage a website
I'm trying to put together a simple RSS widget (for my wordpress blog) that
A while back I put together a simple class named Actor that was my
As I put together each asp.net page It's clear that most of the time
Some time ago I put together a time based library that could be used
I want to put together simple TCP server using Python and Twisted. The server
I've put together a simple form to highlight the concepts of dynamic forms. What
I've put together a simple C++ "Hello World" program to practice; unfortunately, upon compilation
I'm trying to put together a simple system for a user to generate a
I'm looking to put together a simple scriptable backup utility to grab all the

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.