How to prevent a gradual page display?

My site uploads images very slowly. Some text appears, then some tables, then some images ... and then a background image of the body.
How can I make it not show anything until the whole page is ready?

+6
source share
2 answers

You can add a class to the body with display:none and delete it after the page loads.

 <body class="loading"> ... </body> 

and

 <script> window.onload = function(){document.body.className = '';}; </script> 
+4
source

Probably the easiest / best way is to use Javascript for this. The main way I saw this is with a ready-made document handler that reveals all hidden materials.

 $(document).ready(function() { $('*').show(); }); // Or something similar. 

Of course, people like to see some kind of feedback about the "progress", so your site does not look badly encoded or as if the server was junk. Thus, the bootloader panel or something else.

As I mentioned above, the best place for these types of questions is Stack Overflow , and perhaps this will be moved there by a higher ranking person. At the same time, the issue of stack overflow is very similar here.

+3
source

All Articles