Bootstrap 4打开多个导航栏下拉菜单而无需切换

时间:2019-07-05 06:55:34

标签: jquery bootstrap-4

我正在使用带有多层垂直边栏菜单的Bootstrap 4。单击任何下拉菜单项时,先前打开的下拉菜单将自动关闭。问题:我不希望以前打开的下拉菜单自行关闭。用户可以打开多个下拉菜单

尝试了一些脚本来检测具有show类但没有结果的当前导航项。

<ul class="navbar-nav flex-column w-100">
  <li class="nav-item ">
   <a href="#" role="button" class="nav-link">Dashboard</a>
  </li>
  <li class="nav-item dropdown">
   <a href="#" class="nav-link dropdown-toggle" role="button" data-toggle="collapse" aria-haspopup="true" aria-expanded="false">Data Entry</a>
   <div class="dropdown-menu " aria-labelledby="dropdownMenuButton">
     <a class="dropdown-item" role="button" href="/#">Add Job</a>
     <a class="dropdown-item" role="button" href="#">Auto Upload</a>
     <a class="dropdown-item" role="button" href="#">Manage Centah</a>
     <a class="dropdown-item" role="button" href="#">Manage TGS</a>
   </div>
  </li>
  <li class="nav-item dropdown">
   <a href="#" class="nav-link dropdown-toggle" role="button" data-toggle="collapse" aria-haspopup="true" aria-expanded="false">Data Entry</a>
   <div class="dropdown-menu " aria-labelledby="dropdownMenuButton">
     <a class="dropdown-item" role="button" href="/#">Add Job</a>
     <a class="dropdown-item" role="button" href="#">Auto Upload</a>
     <a class="dropdown-item" role="button" href="#">Manage Centah</a>
     <a class="dropdown-item" role="button" href="#">Manage TGS</a>
   </div>
  </li>
</ul>

1 个答案:

答案 0 :(得分:0)

单击包含复选框的下拉项目时,菜单关闭。 插件不处理下拉项目的内容。无论您在下拉菜单项中有什么,单击它都会关闭菜单。

您可以在这里跟踪它:https://github.com/twbs/bootstrap/issues/21941