jQuery image preload/cache halting browser

Posted by Nathan Loding on Stack Overflow See other posts from Stack Overflow or by Nathan Loding
Published on 2010-06-15T02:51:45Z Indexed on 2010/06/15 4:02 UTC
Read the original article Hit count: 422

Filed under:
|
|

In short, I have a very large photo gallery and I'm trying to cache as many of the thumbnail images as I can when the first page loads. There could be 1000+ thumbnails.

First question -- is it stupid to try to preload/cache that many?

Second question -- when the preload() function fires, the entire browser stops responding for a minute to two. At which time the callback fires, so the preload is complete. Is there a way to accomplish "smart preloading" that doesn't impede on the user experience/speed when attempting to load this many objects?

The $.preLoadImages function is take from here: http://binarykitten.me.uk/dev/jq-plugins/107-jquery-image-preloader-plus-callbacks.html

Here's how I'm implementing it:

$(document).ready(function() {
    setTimeout("preload()", 5000);
});
function preload() {
    var images = ['image1.jpg', ... 'image1000.jpg'];
    $.preLoadImages(images, function() { alert('done'); });
}

1000 images is a lot. Am I asking too much?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about image