Professional vBulletin Hosting!
thumb

Premium & Custom vB Skins..

vBulletin and Coding Guides
Make an Image preloader script PDF Print E-mail

This isn't really as much a how to as a copy and paste job but as long as it works for you hopefully you'll be happy.

Step 1:
Open up your desired vB template or html file. Add the JS opening tags:

HTML Code:
<script type="text/javascript"><!--

Now we need to define the actual image loading function:

Code:
function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

Next we define the "other" image preloading function.

HTML Code:
var preloadFlag = false;
function preloadImages() {
if (document.images) {
image = newImage("X");
preloadFlag = true;
}

}

Change X to the path of your image.
Then finish off the JS:

HTML Code:
//--></script>

Now you need to trigger the image preloader to do that you need to put the following in your <body> tag:

HTML Code:
onload="preloadImages();"
And your done