0

Here is the jQuery code

$(document).ready(function(){
    $("#menu li").hover(
        function(){
            $(this).children(":hidden").stop().slideDown();
        },
        function(){
            $(this).parent().find("ul").slideUp();
        }
    );
});

The menu drops a unorganized html list which is working fine and is not the issue.

When the menu drops the hidden list it allows for another drop to happen while the other is still sliding up. Is there way to stop the new list from slideing down while the other list is still sliding up?

For example if you look at this websites navigation menu bar it will show you what I mean you can not look at another drop down till the other has returned.

orderstore.co.uk

This is the problem: enter image description here

Jsfiddle of my problem: http://jsfiddle.net/hSH7e/2/

3
  • Can you put a simplified version of your html, css and javascript in a JS fiddle? It would be much easier to debug your code rather than looking at a .png. Oct 26, 2013 at 22:13
  • I did attempt to but could not get the jquery to function ill give it another go Oct 26, 2013 at 22:31
  • JSFiddle Oct 26, 2013 at 22:39

1 Answer 1

0

You need to reset others and then expand this:

$(document).ready(function(){
    $("#menu li").hover(
        function(){
            if ($("#menu li").find("ul:visible").length)
            {
                curMenu = this;
                $("#menu li").find("ul:visible").slideUp(function(){
                    $(curMenu).children(":hidden").stop().slideDown();
                });
            }
            else
                $(this).children(":hidden").stop().slideDown();
        },
        function(){
            $(this).parent().find("ul").slideUp();
        }
    );
});

Fiddle: http://jsfiddle.net/praveenscience/hSH7e/5/

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.