简体   繁体   中英

Can't close dropdown in twitter bootstrap 3.1.0

I created a navbar and added a .slideDown() and .slideUp() effect on two dropdowns

This how it works:

If i hover my mose to the dropdown the the .mouseenter() event is triggered and the contents of the dropdown will slide down and if i unhover my mouse to the dropdown it will slide up and hide the contents.

Problem:

When i unhover the mouse on the first dropdown, it won't hide and when i try in the second i hovered it and it didn't work, i clicked it it worked but won't hide when i unhover my mouse to the second dropdown.

Fiddle: http://jsfiddle.net/jakobaindreas11/32S7a/

Your script has to be

$(document).ready(function () {
    $(".dropdown").mouseenter(function () {
        $(this).children('.dropdown-menu').stop().slideDown();
    }).mouseleave(function () {
        $(this).children('.dropdown-menu').stop().slideUp();
    });
});

Demo: Fiddle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM