Created
October 16, 2014 14:00
-
-
Save yratof/721e3d87231bb0ebeffd to your computer and use it in GitHub Desktop.
Battling FOUT with SCSS and Bourbon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# Typekit and FOUT. | |
FOUT means "Flash of Unstyled Text" | |
and that happens when the site loads before the | |
javascript can get the fonts needed for the | |
page to be styled. | |
Typekit have suggested "how about you hide | |
everything until they load?" and have provided | |
a javascript way of getting the fonts to load. | |
Which might work, but if the javascript doesn't | |
load, we're still going to have a flash of | |
text right? | |
*/ | |
// Give the body a transition for opacity. | |
body { @include transition(opacity 0.3s ease-out); } | |
// Hide the body when the fonts are loading... | |
.wf-loading { | |
body { opacity: 0; } | |
} | |
// Bring the body in when they have loaded... | |
.wf-active { | |
body { opacity: 1; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment