javascript - Dynamically load google fonts after page has loaded -
i able have user select font page displayed in. here way google recommends using javascript.
webfontconfig = { google: { families: ['tangerine', 'cantarell'] } }; (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); })();
how can modify can re-get fonts after page has loaded?
check out webfont.load command in github repo:
https://github.com/typekit/webfontloader
you can load whatever font want dynamically:
<script src="http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js"></script> <script> webfont.load({ google: { families: ['droid sans', 'droid serif'] } }); </script>
Comments
Post a Comment