gpt4 book ai didi

css - 字体加载速度更快?

转载 作者:太空宇宙 更新时间:2023-11-04 04:41:33 25 4
gpt4 key购买 nike

我需要一些解决方案或建议来在网站中加载更快的字体。

有点像

@font-face {
font-family: 'myfont';
src: url('myfont.eot');
src: url('myfont.eot?#iefix') format('embedded-opentype'),
url('myfont.woff') format('woff'),
url('myfont.ttf') format('truetype'),
url('myfont.svg#nexa_heavyregular') format('svg');
font-weight: normal;
font-style: normal;
}

在 html 加载或下载字体 url 时需要一些时间来更改字体,有什么想法可以更快地加载它吗?

最佳答案

你不能让它加载得更快,因为它取决于网络和浏览器字体渲染,但你可以在你的字体正在加载时显示某种加载指示符 FontLoader :

// Show an activity indicator while font is loading...

var fontLoader = new FontLoader(["myfont"], {
"fontsLoaded": function(error) {
// Hide the activity indicator and show the text.
}
}, 3000);
fontLoader.loadFonts();

这是关于 jsFiddle 的演示

关于css - 字体加载速度更快?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15364376/

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