问题描述
我有一个使用bootstrap3实现的下拉菜单,我希望只在点击时显示下拉菜单而不是悬停。我现在的代码:
I have a dropdown menu implemented with bootstrap3 where I wanna make the dropdown visible only on click instead of hover. My code at the moment:
<li class="dropdown">
<a href="#" class="dropdown-toggle disabled" id="without-avatar" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-lg fa-bars"></i>
</a>
<ul class = "dropdown-menu">
<li>......</li>
......
</ul>
</li>
我发现了一些答案,如果我使用 disabled
在一个类
上,那么下拉菜单将仅在点击时可用,而不是悬停。不幸的是,代码无法正常工作。我猜这个答案已经过时了。
I found some answers where it was said if I use disabled
on the a class
then the dropdown menu will be available only on click instead of hover. Unfortunately the code is not working. I guess the answer was outdated.
截至2016年,解决这个问题的首选方法是什么?
As of 2016 what is the preferred way to solve this problem?
推荐答案
引导下拉不会在悬停时下降。请检查封闭元素上的代码,找出定义有问题的悬停事件的位置。
The Bootstrap dropdown does not drop down on hover. Please check the code on the enclosing elements to find where the problematic hover event is defined.
这篇关于仅在点击时引导下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!