Professional vBulletin Hosting!

Make an Image preloader script

Category : vbulletin-and-coding-guides

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

http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/digg_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/reddit_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/delicious_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/blogmarks_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/furl_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/newsvine_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/google_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/facebook_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://www.vbskinstudio.com/wp-content/plugins/sociofluid/images/twitter_48.png

About admin


Post a comment