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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:06:31+00:00 2026-06-18T09:06:31+00:00

I’m trying to create a JavaScript (preferably not jQuery btw) website menu which downs

  • 0

I’m trying to create a JavaScript (preferably not jQuery btw) website menu which downs a drop down of sub-links when each menu item is hovered over. I almost have it fully functional but I’ve hit a bit of a wall and can’t find a solution online.

On the menu button, I have an onmouseover event that shows and animates the sub-link panel. If you mouse out/onto another menu button the panel will disappear and a new one will appear if you’ve hovered over another menu button. The issue is, when you move your mouse from the desired menu button onto the respective panel it disappears, obviously because there’s an onmouseout event on the menu button to do just that! I need the onmouseout on the button but how can I prevent it from firing the hide function when the mouse moves over the panel?

I’ve tried to think of a way around this but I’ve failed so far so any help would be greatly appreciated!

Thanks,

Andy

<script type="text/javascript">

    var anim = new Animator();

    function Animator() {

        this.slideDown = function (element, height) {

            var e = document.getElementById(element);
            var counter = 0;
            e.style.display = 'block';

            var interval = window.setInterval(function () {
                counter += 2;
                e.style.height = counter + 'px';

                if (counter >= height) {
                    clearInterval(interval);
                }
            }, 1);

        };

        this.hideSlide = function (element) {
            var e = document.getElementById(element);
            e.style.display = 'none';
            e.style.height = 0 + 'px';
        }
    }

</script>
</head>
<body>
<form id="form1" runat="server">
<div id="divMenuBar">
    <div class="menuButton" onmouseover="anim.slideDown('divMenu1', 305);" onmouseout="anim.hideSlide('divMenu1');">Click Me</div>
    <div id="divMenu1" class="slidingMenu menu1">
        <ul>
            <li>Option 1</li>
            <li>Option 2</li>
            <li>Option 3</li>
            <li>Option 4</li>
            <li>Option 5</li>
            <li class="end">Option 6</li>
        </ul>
    </div>
    <div class="menuButton" onmouseover="anim.slideDown('divMenu2', 305);" onmouseout="anim.hideSlide('divMenu2');">Click Me</div>
    <div id="divMenu2" class="slidingMenu menu2">
        <ul>
            <li>Option 1</li>
            <li>Option 2</li>
            <li>Option 3</li>
            <li>Option 4</li>
            <li>Option 5</li>
            <li class="end">Option 6</li>
        </ul>
    </div>
    <div class="menuButton" onmouseover="anim.slideDown('divMenu3', 305);" onmouseout="anim.hideSlide('divMenu3');">Click Me</div>
    <div id="divMenu3" class="slidingMenu menu3">
        <ul>
            <li>Option 1</li>
            <li>Option 2</li>
            <li>Option 3</li>
            <li>Option 4</li>
            <li>Option 5</li>
            <li class="end">Option 6</li>
        </ul>
    </div>
    <div class="menuButton" onmouseover="anim.slideDown('divMenu4', 305);" onmouseout="anim.hideSlide('divMenu4');">Click Me</div>
    <div id="divMenu4" class="slidingMenu menu4">
        <ul>
            <li>Option 1</li>
            <li>Option 2</li>
            <li>Option 3</li>
            <li>Option 4</li>
            <li>Option 5</li>
            <li class="end">Option 6</li>
        </ul>
    </div>
</div>
</form>

  • 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-06-18T09:06:32+00:00Added an answer on June 18, 2026 at 9:06 am

    I am sure that you have your reasons for not wanting to use jQuery (or other UI frameworks) so I will not push that issue. But in general, you will have to write your code similar to how those frameworks do their menus.

    Rather than blindly hiding an element on mouseout as you are doing now, you instead need to build in logic to see what the mouse is now over, and if it is over a child panel, it needs to maintain the panel visibility. This can get rather sticky if you start getting into sub-menus.

    But however you write it, there is no free lunch here. Your buttons and menu panels will need to know about each other and how they relate. And you will have to make explicit decisions about what to hide and show and when.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I am trying to render a haml file in a javascript response like so:
I'm trying to select an H1 element which is the second-child in its group
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I am reading a book about Javascript and jQuery and using one of the
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.