简体   繁体   English

引导下拉菜单仅在单击时

[英]bootstrap dropdown only on click

I have a dropdown menu implemented with bootstrap3 where I wanna make the dropdown visible only on click instead of hover. 我有一个用bootstrap3实现的下拉菜单,我想使该下拉菜单仅在单击时显示,而不是悬停显示。 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>

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. 我发现有人回答说如果我在a class上使用了disabled ,那么下拉菜单将仅在单击时可用,而不是悬停时可用。 Unfortunately the code is not working. 不幸的是,代码无法正常工作。 I guess the answer was outdated. 我猜答案已经过时了。

As of 2016 what is the preferred way to solve this problem? 截至2016年,解决此问题的首选方法是什么?

The Bootstrap dropdown does not drop down on hover. Bootstrap下拉列表在悬停时不会下拉。 Please check the code on the enclosing elements to find where the problematic hover event is defined. 请检查包含在元素上的代码以查找有问题的悬停事件的定义位置。

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

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