Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Load Fontdeck fonts asynchronously with hidden text timeout
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script>
function async(url) {
var a = document.createElement('script');
a.async = true;
a.src = url;
var b = document.getElementsByTagName('script')[0];
b.parentNode.insertBefore(a, b);
}
(function() {
var htmlEl = document.getElementsByTagName('html')[0];
htmlEl.className += ' js wf-loading';
setTimeout(function() {
htmlEl.className = htmlEl.className.replace(' wf-loading', '');
}, 2000);
WebFontConfig = {
fontdeck: { id: 000000 }
}
async('http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js');
})();
</script>
<style>
body {
background: grey;
}
.wf-loading body {
visibility: hidden;
}
</style>
</head>
<body>
Testing testing
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment