Select 2 图书馆点击移动到顶部

Select 2 library click move to top

当我点击 select2 容器并打开它时,我的页面突然滚动到顶部。 我怎么解决这个问题?

将此添加到您的 css

.select2-container, .select2-dropdown, .select2-search, .select2-results {
  -webkit-transition: none !important;
  -moz-transition: none !important;
  -ms-transition: none !important;
  -o-transition: none !important;
  transition: none !important;
}

我希望这对以后的人有所帮助

此错误在某些 bootstrap 版本和 select2.js 中是 运行。现在我通过删除 select2.js source 中的 top prop 解决了这个问题。 - 打开 select2.js 或 select2.min.js - 找到 $dropdownContainer.remove() 然后你可以看到 top 属性 。删除它然后保存文件。

你可以看到另一个人的问题: https://jsfiddle.net/OlegKi/fL9fj2sL/1

Thankyou