-
-
Save barrd/e34d5a2832da339910ab6ba180ac0dfe to your computer and use it in GitHub Desktop.
Prevent FOUC (flash of unstyled content)
This file contains 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
<!-- @see http://johnpolacek.com/2012/10/03/help-prevent-fouc --> | |
<!-- WordPress implementation --> | |
<!-- Add to header --> | |
<style type="text/css"> | |
.no-fouc {display: none;} | |
</style> | |
<script> | |
document.documentElement.className = 'no-fouc'; | |
</script> | |
<!-- Add to footer --> | |
<script> | |
jQuery(document).ready(function( $ ) { | |
$('.no-fouc').removeClass('no-fouc'); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment