Skip to content

Instantly share code, notes, and snippets.

@jamesdavidson
Created May 8, 2012 07:42
Show Gist options
  • Save jamesdavidson/2633323 to your computer and use it in GitHub Desktop.
Save jamesdavidson/2633323 to your computer and use it in GitHub Desktop.
Throw in a new font from Google WebFonts and mix it straight in with your T.Bootstrap HTML page.
function installAndUse(fontName, jQSelector)
{
WebFontConfig = {
google: { families: [ fontName ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
$(jQSelector).css({"font-family":fontName});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment