Preloading images

  JoJoJo 14:22 30 Jun 2003
Locked

I have a web page that has a large picture in the centre and underneath are several thumbnails. When the user clicks on the thumbnails the larger image changes and a description of the thumbnail appears underneath the larger picture. This works fine but obviously the thumbnails and the original large image need to load first so the user doesn't have to wait a long time for the larger pictures to download that they may not even see.

Does anyone no a way of some how specifying the order that images load onto the page so that when it appears to have loaded page the larger images would still be loading in the background - downloading them to the users computer so when the thumbnail is clicked the large image instatly changes?

  powertool 21:05 01 Jul 2003

you can use this piece of javascript to preload your images so that you get an instant flip. Put this code between your <head> </head> flags:


<SCRIPT LANGUAGE="javascript">

Image1= new Image(200,200)

Image1.src = "button1.gif"

Image2= new Image(200,200)

Image2.src = "button2.gif"
</SCRIPT>

notes:
200,200 is the image size in pixels.
Image1.src = "the path to your image"

you can keep adding more images, just call each new image Image3, 4, 5, etc.

I learnt this from the book Javascript Goodies by Joe Burn.

  powertool 21:13 01 Jul 2003

is meant to be on a new line!

I don't know how to force images to load in a particular order though!

hope you can use this

powertool

  powertool 21:15 01 Jul 2003

"</SCRIPT>"

I mean.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

OnePlus 5 review

Alice Saey's mesmerising animation for Dutch singer Mark Lotterman

iPad Pro 10.5in (2017) review

Comment booster votre iPhone ?