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

The Archive Base Latest Questions

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

In this nav bar I’m working on, I have a div appear when you

  • 0

In this nav bar I’m working on, I have a div appear when you mouse over a button and it disappears when you mouse out of it. Problem is, when I mouse out of the button and move down into the appearing div, I don’t want the div to disappear since it contains links. I want it to only disappear when I mouse out of the button (not onto the appearing div) and out of the appearing div.

I’m using the OnMouseOver and OnMouseOut functions for this.

What if statement do I use inside the else statement that will allow me to do what I’m looking for (as described above)?

The javascript:

function showlayer(layer){
var myLayer = document.getElementById(layer);
if(myLayer.style.display=="none" || myLayer.style.display==""){
myLayer.style.display="block";
} else { 
myLayer.style.display="none";
}
}

The HTML:

<div id="topBar">
    <div id="navContainer">
    (...)
    <a href="#" class="nav" onmouseover="javascript:showlayer('commLinks')" onmouseout="javascript:showlayer('commLinks')"><div class="communityBtn">Community</div></a>

<div id="subnavLayer">
<div class="commHidden" id="commLinks">
    <div class="commLinksText">Booster Club</div>
    <div class="commLinksText">PTO</div>
    <div class="commLinksText">Fine Arts</div>
    <div class="commLinksText">City of West Branch</div>
</div>

  • 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-24T09:08:41+00:00Added an answer on May 24, 2026 at 9:08 am

    I think people usually accomplish this sort of thing by making the popup nav be a child node of the heading. That way when the user mouses over the popup’s options, the mouse is still technically inside the heading and doesn’t trigger the mouseout event.

    <div id="topBar">
        <div id="navContainer">
        <div class="nav" onmouseover="javascript:showlayer('commLinks')" onmouseout="javascript:showlayer('commLinks')">
            <div class="communityBtn">Community</div>
            <div id="subnavLayer" style="position:absolute">
                <div class="commHidden" id="commLinks">
                    <div class="commLinksText">Booster Club</div>
                    <div class="commLinksText">PTO</div>
                    <div class="commLinksText">Fine Arts</div>
                    <div class="commLinksText">City of West Branch</div>
                </div>
            </div>
        </div>
    </div>
    

    The best part of structuring your HTML this way is that you can actually get a popup with only CSS and no script at all. Basically you’d have a style looking something like this:

    #subnavLayer {
        display:none;
    }
    .nav:hover #subnavLayer {
        display:block;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have anchor tags like this <div id=menu_container> <ul id=nav-bar> <li><a href=Default.aspx runat=server id=menu_item_default>Home</a></li>
I have a problem with my WordPress theme (html5) nav bar not showing site
little stuck on this jquery. I have a banner above my nav bar, which
Strange problem this one. I want the nav bar on the following site to
In the nav bar on this site, we're having a problem with padding on
I have a slide out nav bar that I would like open by default
I have a nav bar with bar button items on the left and right
I have a basic website nav layout that looks like this: <li class=folder parent_folder>
Okay so i have a nav bar on top of the webpage and on
hey guys, I have a standard nav bar with an unordered list and using

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.