我正在使用 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 开关的情况下使用 glyphicon 时,glyphicon 工作正常。 有人对此有解决方案吗?
最佳答案
最新版本的 Bootstrap(>= v4.0) 将不支持 glyphicon 图标。在他们提到的官方网站中,如果你需要图标,一些选项是:
- Glyphicons 的上游版本
- 奥克康
- 字体很棒
找到下面的链接以阅读详细信息。
关于jquery - 带有 Bootstrap 开关的 Bootstrap glyphicon,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49026298/