Created
January 27, 2011 22:40
-
-
Save jedp/799455 to your computer and use it in GitHub Desktop.
Gracefully handle the unavailability of Typekit
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
if (typeof Typekit != 'undefined') { | |
try { | |
Typekit.load({ | |
active: function() { | |
// it worked. carry on ... | |
} | |
}); | |
} catch(e) { | |
// probably want to fall back to no typekit | |
$('html').addClass('wf-inactive').removeClass('wf-loading'); | |
} | |
} else { | |
// typekit js is unavailable; so set html to wf-inactive class | |
$('html').addClass('wf-inactive').removeClass('wf-loading'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment