避免双击来切换 Bootstrap 下拉菜单 [英] Avoid having to double-click to toggle Bootstrap dropdown
问题描述
我正在使用 Bootstrap 下拉菜单.问题是它永远不会在第一次点击时掉下来;我需要单击 2 次才能切换它.我猜点击事件在传播之前以某种方式卡在某个地方......
I am using a Bootstrap dropdown menu. The problem is that it never drops down upon the first click; I need to click 2 times for it to be toggled. I guess the click event is somehow getting stuck somewhere before propagating down...
有什么办法可以解决吗?
Is there any way to fix that?
推荐答案
如果有人使用带有 ui-bootstrap
模块的 angular 以及正常的 bootstrap HTML 下拉定义,还需要点击两次.
If someone is using angular with ui-bootstrap
module along with normal bootstrap HTML dropdown definition, there are also two clicks needed.
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>
[...]
</li>
=> 删除 data-toggle="dropdown"
将解决问题.
=> Removing the data-toggle="dropdown"
will fix the issue.
此后一键打开下拉菜单即可.
Opening the dropdown with one click will work after this.
参考:https://github.com/angular-ui/bootstrap/issues/2294
这篇关于避免双击来切换 Bootstrap 下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!