相关疑难解决方法(0)

如何知道是否已加载字体(@ font-face)?

我正在使用Font-Awesome,但是在未加载字体文件时,图标显示为.

所以,我希望这些图标display:none不会加载文件.

@font-face {
  font-family: "FontAwesome";
  src: url('../font/fontawesome-webfont.eot');
  src: url('../font/fontawesome-webfont.eot?#iefix') format('eot'), url('../font/fontawesome-webfont.woff') format('woff'), url('../font/fontawesome-webfont.ttf') format('truetype'), url('../font/fontawesome-webfont.svg#FontAwesome') format('svg');
  font-weight: normal;
  font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)

我怎么知道这些文件已经加载,我终于能够显示图标了?

编辑: 我没有在页面加载(onload)时说话,因为字体可以在整个页面之前加载.

javascript css jquery font-face font-awesome

78
推荐指数
4
解决办法
6万
查看次数

为什么这些font-face中的一个在IE8中渲染,但其他的不是?

为什么在IE8中呈现此字体:

@font-face {
  font-family: 'Aller';
  src: url('aller_rg-webfont.eot');
  src: url('aller_rg-webfont.eot?#iefix') format('embedded-opentype'),
       url('aller_rg-webfont.woff') format('woff'),
       url('aller_rg-webfont.ttf') format('truetype'),
       url('aller_rg-webfont.svg#AllerRegular') format('svg');
  font-weight: normal;
  font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)

而这不是:

@font-face {
  font-family: 'Champagne';
  src: url('champreg-webfont.eot');
  src: url('champreg-webfont.eot?#iefix') format('embedded-opentype'),
       url('champreg-webfont.woff') format('woff'),
       url('champreg-webfont.ttf') format('truetype'),
       url('champreg-webfont.svg#Champagne&LimousinesRegular') format('svg');
  font-weight: normal;
  font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)

我真的无法弄明白.显然,所有其他浏览器工作正常.

css fonts internet-explorer font-face

7
推荐指数
1
解决办法
1万
查看次数