0

I am building a drop down menu using jQuery and CSS. When you hove a menu item, a list of sub-menu items is revealed below it.

However, because this affects the height of the menu overall (the submenu pushes menu items below it down), it can create an unwanted bouncing effect when trying to navigate.

I'm thinking that I could prevent this by delay the jQuery function that toggles the submenu until the previous toggle has been completed.

Is this possible?

Look at the fiddle below,, here is my current js:

$(document).ready(function () {  // Shows animates submenu transition
    $("ul.available_actions li").hover(function () {
        $("ul.available_actions li ").removeClass("menu_show");
        $(this).delay(30).addClass("menu_show");
        $(".menu_show ul li").toggle(170);
    });
});

Here is a link to a fiddle: http://jsfiddle.net/msEKE/
(Please ignore the submenu items, it's using Asp.Net MVC)

1 Answer 1

1

I guess you want something like stop() :

$(".menu_show ul li").stop().toggle(170);

Demo

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.