本文介绍了在Bootstrap4中的模式中滚动下拉菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在从Bootstrap4 alpha迁移到稳定的Bootstrap4.到目前为止,一切都很好,除了我的模态有这个问题.我到处都使用下拉菜单,包括包含很多项目的下拉菜单.以前,滚动效果很好.现在不行了:当我滚动时,这是正在滚动的模式过滤器(.modal-backdrop),而不是下拉列表.

I'm currently migrating from Bootstrap4 alpha to Bootstrap4 stable. So far, so good, except this problem I have with my modals. I'm using dropdowns everywhere, including ones with many items. Previously, the scrolling was working perfectly. Now it does not: when I scroll, this is the modal filter (.modal-backdrop) that is scrolling, and not the dropdown's list.

以下是整页示例:

https://www.codeply.com/go/JKlWFeOgtU

推荐答案

另一种解决方法是在下拉菜单中设置一个空的data-boundary ...

Another workaround is to set an empty data-boundary on the dropdown...

https://www.codeply.com/go/X8QPbNtp1E

<div class="btn-group dropdown">
      <button type="button" class="btn btn-secondary btn-sm dropdown-toggle" data-toggle="dropdown" data-boundary="">Dropdown</button>
      <div class="dropdown-menu mt-5">
        <a class="dropdown-item" href="#">Action</a>
                        ...
      </div> 
</div> 

这篇关于在Bootstrap4中的模式中滚动下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 07:08