Created
February 3, 2015 11:32
-
-
Save KingScooty/a419eb8a4f820b5f60f2 to your computer and use it in GitHub Desktop.
Make Typekit non-blocking for smaller screens
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
<script> | |
//Replace this with your mobile Typekit code | |
var kit = 'xxxxx'; | |
// Adjust the width threshold | |
if( window.innerWidth < 800 ) { | |
document.write('\x3Cscript src="//use.typekit.net/'+ kit +'.js" onload="try{Typekit.load();}catch(e){}" async>\x3C/script>'); | |
} else { | |
document.write('\x3Cscript src="//use.typekit.net/'+ kit +'.js">\x3C/script>'); | |
document.write('\x3Cscript>try{Typekit.load();}catch(e){}\x3C/script>'); | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment