DIV preload with image upload

I have a problem. I am working on CMS, his name is Dolphin. In a few words, I created a block containing heavy code (jQuery, javascript, php, HTML, images ... etc.). I want to show the boot image until the contents of this block are fully loaded. Therefore, even if it may seem strange, I need a preload function for the DIV. I need to do this, because if I do not use it, I can see how slowly the div is folding, and this is terrible. Do you know a good jQuery or javascript function that can help me with this? Just load the image in the center of the DIV until its contents are fully loaded. Once it is downloaded, it will be shown .. Thank you!

+4
source share
2 answers

The trick sets a real div, hidden by default, and a β€œWait” div is placed above it. At the end of heavy coding, add a line hiding the Wait div and showing the real one.

Sample code for the required HTML:

<div id="pnlPleaseWait"> Loading please wait... <div> <div id="pnlMain" style="display: none;"> ....heavy stuff going on here... ....heavy stuff going on here... ....heavy stuff going on here... </div> 

And jQuery lines at the end of heavy processing:

 $("#pnlPleaseWait").hide(); $("#pnlMain").show(); 
+6
source

All Articles