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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:45:03+00:00 2026-06-04T09:45:03+00:00

Hi I have created a jquery megamenu for an ecommerce platform. I have set

  • 0

Hi I have created a jquery megamenu for an ecommerce platform. I have set it up so that when you hover over a li in the top level, all of its siblings ul vanish and the relevant one appears. The problem is if you hover over ‘gloves’ then ‘helmets’ very quickly the ‘gloves’ appears as if there is a delay. Yet, if you go from ‘helmets’ to ‘gloves’ very quickly it works fine. any ideas? thanks

here is the jquery code and link to site
http://www.firecrestmoto.co.uk/index.php

      // Add controller class to <li> on top level
      $('#menu.accordion ul li ul    li').parent().parent().parent().addClass('parentitem');


      // Hide and show entire category and sub categories at the same time
      $('#menu.accordion a').addClass('menu_closed');
       $('#menu.accordion a').hover(

    function(){
    $(this).addClass('menu_open');
    $(this).siblings('ul').fadeIn();
    $('#menu.accordion ul li ul').show();
    }
    );

      $('ul.parentitem').mouseleave(function(){
$(this).hide();
       });


      // Hover on <li> in the top level menu
    $('#menu.accordion li').hover(function(){
$(this).siblings('li').children('ul.parentitem').hide();
$(this).children('ul.parentitem').css('z-index','10000');
});


        // Leave the main menu div, all submenus disappear
         $('#menu').mouseleave(function(){
$(this).children('li').children('ul').hide();
        });


     // Add controller classes to <li> on each sub level
       $('#menu.accordion').children('li').addClass('topline');
        $('#menu.accordion ul.parentitem').children('li').addClass('finallines');
  • 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-04T09:45:04+00:00Added an answer on June 4, 2026 at 9:45 am

    I think you have too many hover events firing – so if you move your mouse quickly there is a lot going on.

    When you hover over a top level menu item, you are hovering over both <a> and <li>, so

    $('#menu.accordion a').hover(
    

    and

    $('#menu.accordion li').hover(
    

    will both execute.

    Also, jQuery .hover() takes either:

    hover( handlerIn(eventObject) , handlerOut(eventObject)  ) 
    

    or

    hover( handlerInOut(eventObject)  )
    

    So in your case you are using handlerInOut because you are using only one function inside hover() – so the function fires when the mouse enters AND when the mouse leaves. That means that when you move in and out a top level navigation item there are four events firing.

    Also, note that $('#menu.accordion li') will match not only the top level items, but also every li in the sub-menu, and you are attaching a hover event to each of them. This is way too many events.

    So instead of both hovers, try something like this:

    $('#menu.accordion').children('li').hover(function(){
            // Add here your code for mouse enter
            $(this).siblings('li').children('ul.parentitem').hide();
            $(this).children('ul.parentitem').css('z-index','10000');
            $(this).find('a').addClass('menu_open');
            $(this).find('ul').fadeIn();
            // I'm not sure what the following is supposed to do...
            // ...you are showing ul in all sub-menus.
            $('#menu.accordion ul li ul').show();
        }, function(){
            // Add here your code for mouse leave
            $(this).find('a').removeClass('menu_open');
            $(this).children('ul.parentitem').css('z-index','0').hide();
        },
    );
    

    You might need to adjust and clean up the above code – this is just a general idea.

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

Sidebar

Related Questions

I have created some JQuery that will expand a div 'popup' on hover and
I have created a jQuery animation that can be seen by clicking the Preview
I have created a dynamic list picker script using Jquery 1.3 and PHP that
I have created some JQuery that on click of specified HTML it then becomes
I have created a jQuery script to drag elements over the document. I done
I have created a form that must pass validation via JQuery to see if
I have created a jQuery elastic plugin. I have the problem that if I
I have created a web page using JQuery Mobile that has a link at
I have created a jQuery ajaxTransport handler (for some testscases I have) that is
I have created the widget in Jquery mobile for Tabs. I want that when

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.