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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:30:46+00:00 2026-05-20T13:30:46+00:00

I’m making a menu in jquery. You can see it at http://mywash.dk/testtest/index.html The submenu

  • 0

I’m making a menu in jquery. You can see it at http://mywash.dk/testtest/index.html

The submenu that is shown from the start (below ‘Hvordan’) is the active menu so it should always be shown (unless you hover on another menu-item in which case another submenu should show.

It’s working okay but has 1 annoying bug. When you hover from ‘Hvad’ to ‘Hvem’ it quickly display and hides the active menu before showing the menu it is supposed to.

Any idea why this is the case?

Thanks so much for your help!

Jquery:

$(document).ready(function() {

    $('#menu > ul > li:not(.inpath) ul').hide();
    $('#menu .inpath ul').show();
    $('#menu > ul > li:not(.inpath)').hover(
    function() {
        $('ul', this).show("slide", { direction: "left" }, 400);

        if($('#menu li.inpath ul').is(':visible') && $(this).not('#menu ul li')){
          $('#menu li.inpath ul').hide("slide", { direction: "left" }, 400);
        }


    }, function() {
        $('ul', this).hide("slide", { direction: "left" }, 400);

        if($('#menu li.inpath ul').is(':hidden') && $(this).not('#menu ul li')){
            $('#menu li.inpath ul').show("slide", { direction: "left" }, 400);
        }
    });
});

Html:

<div id="menu">

            <ul>

                <li class="test"><a href="">Hvem</a>
                <ul>
                    <li class="first-item"><a href="index.html">Submenu</a></li>
                    </ul>
                </li>
                <li class="test"><a href="">Hvad</a>
                    <ul>
                    <li class="first-item"><a href="index.html">Produkter</a></li>
                    <li class="activeitem"><a href="cases.html" >Leveringer</a></li>
                    </ul>
                </li>

                <li class="inpath test"><a href="">Hvordan</a>

                    <ul>

                        <li class="first-item"><a href="">Reklame</a></li>
                        <li><a href="">PR</a></li>
                        <li><a href="">Websites</a></li>
                        <li><a href="">Illustrationer</a></li>

                    </ul>

                </li>
                <li class="last-item test"><a href="">Sådan!</a></li>

            </ul>

            <div class="clear"><!--clearfix--></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-20T13:30:46+00:00Added an answer on May 20, 2026 at 1:30 pm

    Your problem is caused by the immediate calling of the hover action when you leave or enter a menu element.

    hoverIntent plugin is one possible fix to your problem

    http://cherne.net/brian/resources/jquery.hoverIntent.html

    Notice on the second demo block you can skip from the first to third block with out triggering the second blocks action even when mousing over it.

    edit:

    <script type="text/javascript">
    $(document).ready(function() {
        $('.default').show()
        $('#menu .menuitem').hover(
        function() {
            $('.banner').each(function() {
                $(this).stop(true,true).hide();
            })
            $('ul', this).show("slide", { direction: "left" }, 400);
        }, function() {
            $('ul', this).hide("slide", { direction: "left" }, 400);
            $('.default').delay(500).show("slide", { direction: "left" }, 400);
        });
    });
    </script>
    

    I added a default and changed some class names around a bit, which wasn’t really necessary, but i think you can figure it out.

    <div id="menu">
        <ul>
            <li class="menuitem"><a href="">Hvem</a>
                <ul class="banner">
                    <li class="first-item"><a href="index.html">Submenu</a></li>
                </ul>
            </li>
    
            <li class="menuitem"><a href="">Hvad</a>
                <ul class="banner">
                    <li class="first-item"><a href="index.html">Produkter</a></li>
                    <li class="activeitem"><a href="cases.html" >Leveringer</a></li>
                </ul>
            </li>
    
            <li class="menuitem"><a href="">Hvordan</a>
                <ul class="banner default">
                    <li class="first-item"><a href="">Reklame</a></li>
                    <li><a href="">PR</a></li>
                    <li><a href="">Websites</a></li>
                    <li><a href="">Illustrationer</a></li>
                </ul>
            </li>
            <li class="menuitem"><a href="">Sådan!</a></li>
        </ul>
        <div class="clear"><!--clearfix--></div> 
    </div>
    

    Jquery submenu, hover in/out animation problem

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.