bootstrap glyphicon with bootstrap switch

问题描述 投票:1回答:2

我正在使用bootstrap-switch和bootstrap v3。

我想使用图标在交换机上显示文本。

如果我使用像这样的字体真棒图标它的工作原理。 using font awesome using font awesome,这里是代码:

$("[name='pets_check_box']").bootstrapSwitch('onText', '<i class="fa fa-check" aria-hidden="true"></i>');
$("[name='pets_check_box']").bootstrapSwitch('offText', '<i class="fa fa-times" aria-hidden="true"></i>');

如果我使用bootstrap glyphicon图标不显示... using bootstrap glyphicon using bootstrap glyphicon这里是代码:

$("[name='pets_check_box']").bootstrapSwitch('onText', '<span class="glyphicon glyphicon-ok"></span>');
$("[name='pets_check_box']").bootstrapSwitch('offText', '<span class="glyphicon glyphicon-remove"></span>');

当我使用没有bootstrap-switch的glyphicon时,glyphicon正常工作。有人有解决方案吗?

jquery html css twitter-bootstrap
2个回答
1
投票

最新版本的Bootstrap(> = v4.0)不支持glyphicon图标。在他们提到的官方网站上,如果你需要图标,一些选项是:

  • Glyphicons的上游版本
  • Octicons
  • 字体很棒

查找以下链接以阅读详细信息。

https://v4-alpha.getbootstrap.com/migration/#components


0
投票

确保你有include bootstrap.css和bootstrap.css在下面的条目

.glyphicon-ok:before {  content: "\e013";}
© www.soinside.com 2019 - 2024. All rights reserved.