简体   繁体   中英

How can I detect whether a web font is loaded and hide text nodes until that happens?

Webkit handles the time before a web-font (@font-face) loads by hiding the text nodes. But not all browsers do this, some show a standard font until the font loads, which I want to avoid. I want to show my page elements, but hide all text nodes until the webfont is loaded.

Can I do this with JavaScript?

I'd like to do it without a 3rd party library so I can learn how it's done.

This question can be answered if you google a little bit more ...

Answer can be found here

jQuery font-spy allows to handle what happens when a font is not loaded yet or is damaged

Original Repository Demo Fonts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM