Skip to content

Instantly share code, notes, and snippets.

@heralight
Last active May 2, 2017 12:22
Show Gist options
  • Save heralight/5273210 to your computer and use it in GitHub Desktop.
Save heralight/5273210 to your computer and use it in GitHub Desktop.
Fix font-awesome firefox FOUT
<script type="text/javascript">
WebFontConfig = {
custom: { families: [ 'FontAwesome' ],
urls: [ '//cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css'] }
};
(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);
})();
</script>
<style type="text/css">
.wf-loading [class^="icon-"],
[class*=" icon-"] {
visibility: hidden;
}
.wf-active [class^="icon-"],
[class*=" icon-"] {
visibility: visible;
}
</style>
@heralight
Copy link
Author

use google webfont loader to fix firefox FOUT with font-awesome
inspired by http://www.html5rocks.com/en/tutorials/webfonts/quick/#toc-fout
and https://developers.google.com/webfonts/docs/webfont_loader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment