gpt4 book ai didi

twitter-bootstrap - Bootstrap 3 字形图标无法正确显示

转载 作者:行者123 更新时间:2023-12-04 07:42:09 30 4
gpt4 key购买 nike

我在网站上使用 Bootstrap 3 的字形图标。它在浏览器中运行良好,但在某些设备上却不能,因为它显示为问号。

我找到了这个修复:Some of Bootstrap3 glyphicons are not displayed correctly on phonegap android webview这解决了设备上的问题,但现在 glyphicon 在 Firefox 中不起作用。 (我正在覆盖 Bootstrap 默认值以在我的 CSS 中使用实际的、非转义字形。)我想知道是否有一种方法可以使用 Firefox 的浏览器检测来编写一些 jquery 以删除我的 CSS 文件中的覆盖并恢复它回到 Bootstrap 的 CSS。

我找到了这个用于浏览器检测的 jQuery 插件:https://github.com/gabceb/jquery-browser-plugin

代码:
JS

if ( $.browser.mozilla ) {
$('a#calendar span').removeClass('glyphicon-calendar');
$('a#calendar span').css({'glyphicon-calendar:before': 'content: "\1f4c5"'});
}

CSS 覆盖 Bootstrap
/* fix glyph not showing on some devices--override the Bootstrap defaults to use the actual, non-escaped glyphs */ 
.glyphicon-calendar:before {
content: "\d83d\dcc5";
}

Bootstrap 的 CSS
.glyphicon-calendar:before {
content: "\1f4c5";
}

谢谢您的帮助。

最佳答案

您可以使用 .glyphicon-nonescaped类,允许您在默认转义字形和非转义字形之间切换:

HTML

<i class="glyphicon glyphicon-calendar glyphicon-nonescaped"></i>

CSS
.glyphicon-nonescaped.glyphicon-calendar:before { 
content: "\d83d\dcc5";
}

jQuery
if($.browser.mozilla) {
$('.glyphicon-nonescaped').removeClass('glyphicon-nonescaped');
}

关于twitter-bootstrap - Bootstrap 3 字形图标无法正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20247529/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com