image bufferring

kbjradmin

New Member
Messages
512
Reaction score
2
Points
0
is there some way to pre-load or buffer the images in a website, before they are needed for use?
 

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
i think you can do it with javascript code. also, you can load the image offscreen at say -1000px by -1000px and then have the same file for when you need to load it.

-xP
 

VPmase

New Member
Messages
914
Reaction score
1
Points
0
You don't necessarily have to have it in an img tag. You could have something like this:

Code:
<script>
function preloadimg(){
//Single Image Load
var img = new Image();
img.src = "www.YOUSITE.com/PATH/TO/IMAGE.jpg"; //Change to correct image link
}
function preloadimgs(){
//Multiple Load
var numofimgs = 5 //Change to the number of images you have
var imgarray = new Array();
for(i=0;i<numofimgs;i++){
imgarray[i] = new Image();
}
imgarray[0].src = "www.YOUSITE.com/PATH/TO/IMAGE1.jpg";
imgarray[1].src = "www.YOUSITE.com/PATH/TO/IMAGE2.jpg";
imgarray[2].src = "www.YOUSITE.com/PATH/TO/IMAGE3.jpg";
imgarray[3].src = "www.YOUSITE.com/PATH/TO/IMAGE4.jpg";
imgarray[4].src = "www.YOUSITE.com/PATH/TO/IMAGE5.jpg";
}
</script>
...
<body onload="preloadimg();">//Or preloadimgs()
 
Last edited:
Top