Jquery: Preload an image on request with a callback function?

Posted by tarnfeld on Stack Overflow See other posts from Stack Overflow or by tarnfeld
Published on 2010-05-29T22:20:06Z Indexed on 2010/05/29 22:22 UTC
Read the original article Hit count: 513

Filed under:
|
|
|

Hey,

I'm helping out a friend with a website he's developing and we are having trouble with preloading images on request. Basically, when the user clicks on a thumbnail of the product a <div> slides down that includes a scrolling carrousel of large images. In total there are about 20MB of images that could be loaded in (if you did them all) so preloading them on the page load would not be an option.

Is there a way that we could call a javascript function that begins to preload about 4 images and then when it's done it has a callback function?

Thanks! P.S. We are using jQuery on the page...

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery