【问题标题】:How to replace bootstrap-select with select2?如何用 select2 替换 bootstrap-select?
【发布时间】:2017-05-08 10:05:47
【问题描述】:

我在整个应用程序中都使用了bootstrap-select。现在应该用相同样式的select2 替换bootstrap-select。更改js 部分的最快和有效方法是什么?

例如:

在 bootstrap-select 中,有一些方法和选项,例如 selectpicker('refresh'),selectpicker('show'),selectpicker('c‌​lose')etc,而在 select2 中,方法是 open,close 等。尽管我将那些 bootstrap-select 方法替换为不太相似的 select2 方法,但我不会t 得到相同的结果并得到奇怪的行为。许多方法在select2 中不可用,如在bootstrap-select

现在我怎样才能以有效的方式使用select2 更新这些代码?

【问题讨论】:

  • 你在使用 bootstrap3 吗?

标签: javascript jquery twitter-bootstrap jquery-select2 bootstrap-select


【解决方案1】:

我认为您只能使用那些曾经应用于您的 select2 下拉菜单的 Bootstrap CSS。

您需要从引导程序中确定使用 CSS 的哪一部分来正确显示您的 select2 下拉菜单。然后您可以删除 Bootstrap CSS 并仅使用该 CSS 为您的 select2 下拉菜单应用样式。

另一个选项是您会从 this 链接中找到 CSS 部分。如果您使用的是 Bootstrap3。

谢谢。

【讨论】:

  • 不只是css js部分呢?
猜你喜欢
  • 1970-01-01
  • 2017-03-23
  • 2016-02-11
  • 1970-01-01
  • 2016-10-11
  • 1970-01-01
  • 2014-10-11
  • 2019-11-15
  • 1970-01-01
相关资源
最近更新 更多