Skip to content

Instantly share code, notes, and snippets.

@Rydgel
Created July 21, 2012 11:40
Show Gist options
  • Save Rydgel/3155583 to your computer and use it in GitHub Desktop.
Save Rydgel/3155583 to your computer and use it in GitHub Desktop.
<script>
(function() {
WebFontConfig = {
fontdeck: {
id: 'YOUR-ID'
}
};
var h=document.getElementsByTagName("html")[0];
h.className+=" wf-loading";
var t=setTimeout(function(){h.className=h.className.replace(/( |^)wf-loading( |$)/g,"");h.className+=" wf-inactive"}, 3000);
var tk=document.createElement("script");
tk.src='//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
tk.type="text/javascript";
tk.async="true";
tk.onload=tk.onreadystatechange=function(){
var a=this.readyState;
if(a&&a!="complete"&&a!="loaded")return;clearTimeout(t);};
var s=document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(tk,s)
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment