0

I am trying to add simple animation to css menu http://jsfiddle.net/BGV2Z/2/

The issue seems to be display:block; . If you hover first time menu works fine , on mouseleave the menu that disappeared appears again in far left position or in top position( depending on level ) .

    $("li").on('mouseenter', function () {

        $(this).find('ul').first().css('display', 'none').fadeIn(500, function () {

            $(this).css('display', 'block');

        });

    }).on('mouseleave', function () {

        $(this).find('ul').first().fadeOut(500, function () {

            $(this).css('display', 'none');

        });
    });

I am missing something obvious any help is appreciated. Thank you!

2 Answers 2

2

Add position: relative; to your CSS for ul.dropdown li

ul.dropdown li {
    float: left;
    min-height: 1px;
    vertical-align: middle;
    margin:0 5px;
    display:block;
    position: relative;
}
Sign up to request clarification or add additional context in comments.

1 Comment

Nice find ! Than you!
1

You could do it without the need of jQuery and use CSS3 animations :)

Just add some transition animations, an example here: http://jsfiddle.net/xine/BGV2Z/13/

1 Comment

Nice one also , but I need bit more animations and also supporting browsers without css3 support. But thank you for the example

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.