Preloading images

  JoJoJo 14:22 30 Jun 03
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 03

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 03

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 03

"</SCRIPT>"

I mean.

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

Best phone camera 2016/2017: Galaxy S7 vs iPhone 7 vs Google Pixel vs HTC 10 Evo vs OnePlus 3T vs…

1995-2015: How technology has changed the world in 20 years

These are the Best Christmas Ads and Studio Projects of 2016

Super Mario Run preview | Hands-on first impressions of Super Mario Run: Mario's iPhone & iPad…