-
-
Save germanny/8457087 to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* Delayed loading of typekit scripts vs Flicker-free loading | |
* Source: https://www.farbeyondcode.com/Delayed-loading-of-typekit-scripts-vs-Flicker-free-loading-5-2304.html | |
* Avg. Load Time: 66ms; 91ms; 113ms | |
*/ | |
?> | |
<script type="text/javascript"> | |
/* <![CDATA[ */ | |
TypekitConfig = { | |
kitId: 'xxxxxxx' | |
}; | |
(function() { | |
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; | |
try { Typekit.load(TypekitConfig); } catch (e) {} | |
}; | |
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