我可以使用两个溢出属性吗?

Can I use two overflow properties?

我正在使用 Bootstrap 和 Select2。

我在 Select2 上遇到了无法点击的搜索框错误,我通过在我的模式中添加 overflow: visible 修复了这个错误。

<div class="modal fade" id="myModal1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true" style="overflow:visible">

但这导致我的模式无法滚动。改成 overflow:scroll 导致之前的 Select2 错误重新出现。

我该怎么做?我可以使用两个溢出属性吗?

在挖掘 Google 可能对我有用的解决方案后,我终于从 here in pymarco's answer 中找到了 真正的答案。您必须将以下代码添加到您的 $(document).ready(function() { });

$.fn.modal.Constructor.prototype.enforceFocus = function () {};

这使得 Select2 搜索和模态滚动都起作用了。