Forum Moderators: open

Message Too Old, No Replies

How can we set a logo display,wait for all page loading

how make a page loading

         

waxbird

9:37 am on Aug 9, 2004 (gmt 0)

10+ Year Member



How can we set a logo display(example a div)
wait for all page loading,display all page and the hidden the logo?

StupidScript

11:17 pm on Aug 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Tough, because it's hard to tell when every last image has loaded.

Assuming you don't want to just place the <div> at the end of your page code, you may be able to select the largest image (in filesize) and place an onload event in its tag, i.e. <img src="huge.jpg" onload="writeDiv()">

Depending on the browser, placing the onload event in the BODY tag may produce the results you seek.

In extreme cases, you can set an incrementing variable in each image AND in the BODY, and then set a timer to check to see that the incrementing variable is at the point that says "done", THEN run a script that writes the <div>.

<script>
incrementer=0;
chkLoaded=setTimeout("chkIncrement()",100);
function chkIncrement() {
if (incrementer==3) {
clearTimeout(chkLoaded);
writeDiv();
}
}
</script>
<body onload="incrementer++">
<img src="pic1.gif" onload="incrementer++">
<img src="pic2.gif" onload="incrementer++">
</body>

As each element (body,pic1,pic2) loads, it updates the incrementer. Every 1/10th of a second the status of the incrementer is checked. When it hits 3 (the total number of page elements including the page) it stops the 1/10th of a second check and triggers the <div> writing function.

JasonHamilton

11:52 pm on Aug 11, 2004 (gmt 0)

10+ Year Member



[example deleted]

Edouard_H

12:00 am on Aug 12, 2004 (gmt 0)

10+ Year Member



The simplest solution would be to include it as a non-repeating background for the page itself - works as long as the page elements cover the background.