防止Bootstrap IE下拉菜单在滚动条单击时关闭 [英] Prevent Bootstrap IE dropdown to close on scrollbar click

查看:136
本文介绍了防止Bootstrap IE下拉菜单在滚动条单击时关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IE中,单击下拉菜单滚动条,将关闭下拉菜单。使用鼠标滚轮滚动时效果很好。

In IE, on click of dropdown menu scrollbar, dropdown closes. It works fine when you scroll it using mouse wheel.

以下是该codeply链接: https:/ /www.codeply.com/go/Uh8qadr3q2

Here is the codeply link: https://www.codeply.com/go/Uh8qadr3q2

建议我,解决此问题的最佳方法是什么。

Suggest me what's the best way to resolve this issue.

推荐答案

新答案



在下拉菜单中添加div元素-可以滚动的菜单:

New answer

Add a div element within your dropdown-menu which will be scrollable:

<div class="dropdown-menu" role="menu">
  <div class="scrollable-menu">
    <ul class="list-unstyled">
      <li class="dropdown-item"><a href="#">Action</a></li>
      ...
    </ul>
  </div>
</div>

我使用的解决方案是添加

The solution I used is to add

onclick="event.stopPropagation();"

到.dropdown菜单

to the .dropdown-menu

然后调用

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

在下拉菜单中单击某个项目时

when clicking an item in the dropdown menu

这篇关于防止Bootstrap IE下拉菜单在滚动条单击时关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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