Skip to content

Instantly share code, notes, and snippets.

@teledirigido
Last active Sep 17, 2015
Embed
What would you like to do?
Font loader
/*
Webfontloader
-------------
Based on: https://github.com/typekit/webfontloader#typekit
DESCRIPTION
-----------
Load multiple fonts asynchronously using Webfontloader
USAGE
-----
custom_fonts.init();
*/
var custom_fonts = {
init: function(){
WebFontConfig = {
typekit: {
id: 'xxxx'
},
google: {
families: ['Montserrat']
},
active: function(){
/*
Callback for when your fonts has been loaded
EXAMPLE
-------
$('.myfonts').addClass('loaded');
*/
}
};
// Add your fonts asynchronously
(function(d) {
var wf = d.createElement('script'), s = d.scripts[0];
wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js';
s.parentNode.insertBefore(wf, s);
})(document);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment