我有以下脚本,它为字体提供本地服务器后备:
<!-- load fonts via webfont.js with local fallback: https://github.com/typekit/webfontloader -->
<script src="//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js"></script>
<script>window.WebFont || document.write('<script src="../assets/js/webfont.js"><\/script>')</script>
<script>
WebFont.load({
// load fonts from CDN
google: {
families: ['Flamenco']
},
custom: {
families: ['FontAwesome'],
urls: [ '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css' ]
}
// load server fallback if CDN is unavailable
fontinactive: function (family, fvd) {
if (family === 'Flamenco' || 'FontAwesome') {
WebFont.load({
custom: {
families: ['Flamenco', 'FontAwesome'],
urls: [ '../assets/fonts/local-fonts.css' ]
}
})
}
},
});
</script>
但是 Firefox 指出这条线缺少一个结束 }
fontinactive: function (family, fvd) {
对于我的生活,我无法弄清楚出了什么问题对不起 - 我确信某处有一个愚蠢的错误。
任何指向正确方向的指针都将不胜感激。
干杯