Skip to content

Instantly share code, notes, and snippets.

@teledirigido
Last active September 17, 2015 03:11
Show Gist options
  • Save teledirigido/7a07c382c068a6c19a19 to your computer and use it in GitHub Desktop.
Save teledirigido/7a07c382c068a6c19a19 to your computer and use it in GitHub Desktop.
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