(jQuery) loading images blindly
I've got image files named 0-0, 0-1, 0-2 and so on up to a certain point, and I want to load each file until it can't find another, hence the jquery ajax error. At the moment, this works in firefox only.
Anyone know any work arounds?
Code:
for (var i = 0; i < _images.length; i++) {
var ready = 1;
var count = 0;
var arr = [];
while(ready) {
var cacheImg = document.createElement('img');
var src = 'files/images/thumbs/' + i + '-' + count++ + '.gif';
$.ajax({
type: 'GET',
url: src,
success: function() { arr.push(src) },
error: function() {
$.preloadImages(arr);
W.lengths.push(count - 1);
ready = null
}
});
}
}