How to preload your site with style


Here is a live example of what appear while loading my pages.

Hello! I’ve finished loading!

Click me to see me disapear again.

Loading… loading logo

I first tried to integrate queryLoader, but it didn’t fill my needs.

The plugin add a black div to hide all the content. But as the script had to be launched at the end of the source code my website show for a small time.

In order to hide this small artefact, here is how I do that.


In a first time, I added at the top of the body the div hiding all the content.

and here is the associated CSS to #blackpage:

and the associated jQuery code:

Yes, it is as simple as that. And, putting the #blackpage div at the top of my page, I ensure to hide anything while loading.

I hope it had helped you!

Published on 2009-10-03
Follow @yogsototh
Yann Esposito©
Done with Vim spacemacs & nanoc Hakyll

ADA: DdzFFzCqrhtAvdkmATx5Fm8NPJViDy85ZBw13p4XcNzVzvQg8e3vWLXq23JQWFxPEXK6Kvhaxxe7oJt4VMYHxpA2vtCFiP8fziohN6Yp