gpt4 book ai didi

html - 文档准备好后延迟字体字体加载

转载 作者:行者123 更新时间:2023-11-28 00:23:10 27 4
gpt4 key购买 nike

有什么方法可以防止在 document.ready 之前获取自定义字体并在之后加载字体?这有助于缩短页面加载时间(浏览器微调器显示的时间)

最佳答案

你可以试试这个:

$(document).ready(function() {
var font_settings = " <style type='text/css'> @font-face {font-family: YourFont; src: url('fonts/YourFont.ttf');}</style>";
$("head").append(font_settings);});

请注意,如果这确实为您提供了所需的内容,您可能最终会看到文本从默认字体闪烁到您指定的任何自定义字体。

关于html - 文档准备好后延迟字体字体加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7617687/

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