I am trying to prevent FOUC on my site. This is my code so far:
<head>
<!--[if lte IE 8]><script src="js/html5shiv.js"></script><![endif]-->
<script src="js/jquery.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/skel-layers.min.js"></script>
<script src="js/init.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-xlarge.css" />
</noscript>
<style type="text/css">
.no-fouc {display: none;}
</style>
<script type="text/javascript">
document.documentElement.className = 'no-fouc';
$(document).ready(function() {
$('.no-fouc').removeClass('no-fouc');
});
</script>
</head>
Where am I going wrong here? I am still getting about 1-2 seconds of FOUC.
Thanks
Jason
This was my solution:
Rather than using:
I used:
Which executes:
when complete page is fully loaded, including all frames, objects and images.