繁体   English   中英

带引导程序开关的引导程序字形

[英]bootstrap glyphicon with bootstrap switch

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

我想使用一个图标作为文本显示在开关上。

如果我使用这样的字体真棒图标,它就可以工作。 使用字体真棒使用字体真棒,这里是代码:

$("[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,则不会显示图标...使用 bootstrap glyphicon使用 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>');

当我在没有引导开关的情况下使用 glyphicon 时,glyphicon 工作正常。 有没有人对此有解决方案?

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

  • Glyphicons 的上游版本
  • 八角形
  • 字体真棒

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

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

确保你有包含 bootstrap.css 和 bootstrap.css 有以下条目

.glyphicon-ok:before {  content: "\e013";}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM