Bootstrap 2.1.1下拉列表无法正常工作 [英] Bootstrap 2.1.1 dropdowns not working properly

查看:91
本文介绍了Bootstrap 2.1.1下拉列表无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在升级到Bootstrap 2.1.1后,我在下拉列表中遇到问题。

I'm having trouble with my dropdowns after upgrading to Bootstrap 2.1.1.

我的页面上的第一个下拉列表工作正常。

The very first dropdown on my page works fine. Opens correctly when clicked on, then closes when clicking on either an item, the dropdown header or the page.

但是,第二个和第三个下拉列表(我猜任何一个下拉不是第一个)在我的页面上不能正常工作。

However, the second and third dropdowns (I'm guessing any dropdown other than the first) on my page don't work correctly.

点击某个项目,网页或其标题时,它们不会关闭。

They don't close when clicking on an item, page or their header.

有点,并找到以下代码段,我不需要之前:

I looked around for a bit and found the following snippet, which I didn't need before:

$('.dropdown-toggle').dropdown();

当我在代码中包含这个时,第二/第三个下拉菜单在点击页面时会关闭,在项目上。他们仍然不工作,当点击他们的标题。

When I include this in my code, the second/third dropdowns do close when clicking on the page or on an item. They still don't work when clicking on their header.

这些下拉列表的HTML与第一个HTML的HTML完全相同。我找不到任何差异,也没有解释为什么只有第一个下拉正常工作。

The HTML for these dropdowns is exactly the same as the HTML for the first one. I can't find any differences, nor an explanation why only the first dropdown works correctly.

我在JSfiddle这里放了一些代码: http://jsfiddle.net/3CysL/1/

I have put some code on JSfiddle here: http://jsfiddle.net/3CysL/1/

推荐答案

您正在将下拉列表触发器与其父级(下拉列表容器)相关联。

这将中断您的触发器,因此更改:

You are linking dropdown triggers with their parent, the dropdown container.
This is breaking your triggers, so change:

href="#media"    -> href="#"
href="#tools"    -> href="#"
href="#language" -> href="#"

这篇关于Bootstrap 2.1.1下拉列表无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆