Pre-loading

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Pre-loading

gavingough
I love Shadowbox!

But...

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?
Reply | Threaded
Open this post in threaded view
|

Re: Pre-loading

crazymichel1
#agree in all points

really need that.
Reply | Threaded
Open this post in threaded view
|

Re: Pre-loading

bklocek
crazymichel1 wrote
#agree in all points really need that.
One more vote. Looks like it's supposed to. See line 1399 of uncompressed shadowbox.js. // preload neighboring images...
Reply | Threaded
Open this post in threaded view
|

Re: Pre-loading

crazymichel1
ah, I see.
good so far, but it does not work, does it?
Reply | Threaded
Open this post in threaded view
|

Re: Pre-loading

mjijackson
Administrator
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.
Reply | Threaded
Open this post in threaded view
|

Re: Pre-loading

crazymichel1
@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.

@preloader:
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).
Reply | Threaded
Open this post in threaded view
|

Re: Pre-loading

fcrbe
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.

Any idea on how to solve?

Cheers,

Frederik
Reply | Threaded
Open this post in threaded view
|

Re: Pre-loading

FranciscoIto
I tried replacing next.href with next.content and prev.href with prev.content and saw a noticeable difference.

Hope it helps.