Created
November 25, 2011 10:10
-
-
Save yvesvanbroekhoven/1393193 to your computer and use it in GitHub Desktop.
typekit asyncy
This file contains 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
<script type="text/javascript"> | |
TypekitConfig = { | |
kitId: 'YOUR_TYPE_KIT_ID', | |
scriptTimeout: 3000 | |
}; | |
(function(){var h=document.getElementsByTagName('html')[0];h.className+=' wf-loading';var t=setTimeout(function(){h.className=h.className.replace(/(\s|^)wf-loading(\s|$)/g,'');h.className+=' wf-inactive';},TypekitConfig.scriptTimeout);var tk=document.createElement('script');tk.src='//use.typekit.com/'+TypekitConfig.kitId+'.js';tk.type='text/javascript';tk.async='true';tk.onload=tk.onreadystatechange=function(){var rs=this.readyState;if(rs&&rs!='complete'&&rs!='loaded')return;clearTimeout(t);try{Typekit.load(TypekitConfig);}catch(e){}};var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(tk,s);})(); | |
</script> | |
/* Available css classes: | |
html.wf-loading = While loading you can hide the fonts to avoid FOUT | |
html.wf-active = Loading complete, typekit loaded, show your fonts | |
html.wf-inactive = Loading failed, typekit not loaded, show your fonts | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment