Is there a way to get images to pre-load? Perhaps by loading the next image in the sequence before the "next" button is pressed? Failing that, could it be set up so that the current image remains on screen whilst the new image loads? The spinning icon could perhaps be shown over the top of the current image until the new image is ready to display. That might be more pleasing than seeing the background displayed whilst images are loading?
The script is already supposed to be preloading neighboring images. It accomplishes this by creating new images and then setting their href's to the url's of the ones you'd like to preload.
The problem with never showing the background happens when it comes time to resize the thing. If you have one photo up, and you want to change to another one, you can't just fade the one you're currently displaying. If you did that, you'd have some ugly gaps around the edges of the new image while you're resizing the box. So I set it up to just show the loading layer, resize, and then fade to the new image. If you can think up a better solution, I'm all ears.
@grey background layer
ok, I see. it's a lot more difficult than I thought.
but while the layer is not really a problem when loading times are short, it is quite frustrating when you wait several seconds having to stare at a grey screen.
if loading times are long, they greatly excel the resize period.
one solution that came into my mind thus would be to first show the old picture and the famous small loading circle only. then, i.e. when the loading is already done, do a quick fadeout, resize and show the new picture. thus, the grey-picture-period could be reduced to a minimum.
do I have to activate it with an option? maybe I misunderstood its purpose but: when I click on the "next"-button I have to wait several seconds until the next picture is loaded (if it is not yet in the cache, of course) no matter how long I waited before clicking. so the next picture has not been downloaded yet (using firefox).
It seems that preloading is no longer working. If you put an alert(next.href) after the line that contains preload_next.src = next.href;, you will see that it is always undefined (I tried it with the downloaded demo as well.