Created
October 30, 2012 11:36
-
-
Save joshje/3979740 to your computer and use it in GitHub Desktop.
Load Fontdeck fonts asynchronously with hidden text timeout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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