简体   繁体   English

无法关闭twitter bootstrap 3.1.0中的下拉列表

[英]Can't close dropdown in twitter bootstrap 3.1.0

I created a navbar and added a .slideDown() and .slideUp() effect on two dropdowns 我创建了一个导航栏并在两个下拉列表中添加了.slideDown().slideUp()效果

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. 如果我将我的mose悬停在下拉列表中, .mouseenter()触发.mouseenter()事件,并且下拉列表的内容将向下滑动,如果我将鼠标移至下拉列表,它将向上滑动并隐藏内容。

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/ 小提琴: 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 演示: 小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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