• 字体
  • 字体家族
  • 字体公司
  • 字体设计师
  • 字体样张
  • 资讯
  • 帮助
字客网>资讯>详情

Fonts.com Web Fonts and FOUT Control

时间:2012-10-19 13:37:53| 新闻|浏览:101|来源:Fonts.com Blog|作者:Domenic Barbuzzi
导语A Brief HistoryWith the start of the Fonts.com Web Fonts service,

A Brief History

With the start of the Fonts.com Web Fonts service, the FOUT (flash of unstyled text) phenomenon was a wide-spread problem. To remedy this issue we added code to our JavaScript implementation.

Our first method included hiding the visibility of elements on pages that used Web fonts. We then crafted a more efficient and cleaner method of preventing FOUT – we use a single class to hide only the text for elements using Web fonts. We then strip that class's properties when the Web fonts are ready to display. One thing to note is that the class is left on these elements in the DOM; however, without properties, the class has no meaning and is invisible to visitors, save for those using some manner of developer tools.

Back to the Present

Since the introduction of Web fonts, broadband connections have grown more common, and browsers have matured in handling embedded fonts. So has the Fonts.com Web Fonts service. We have adjusted our JavaScript in two key ways:

FOUT-prevention is disabled by defaultNow there are configuration options that can be set before loading our JavaScript in order toturn FOUT-prevention back on and traverse through the DOM to remove the mti_font_element class

The goodies

Below is a sample usage of the FOUT configuration options. To utilize them, simply define the options before including the SCRIPT tag for your Web fonts project. If any of the options are omitted, their default values will be used instead.

0
  • 关注字客网公众号领取Z码
  • 关注字体先森公众号抽取SVIP
相关字体公司
Fonts.com Web Fonts and FOUT Control 网友点评
游客:文明上网,理性发言。 看不清?换一张
Fonts.com Web Fonts and FOUT Control 最新评论
暂无相关评论