I have a problem that I cannot handle. I created a simple jQuery album gallery and I have this function:
function loadAlbum (index) {
for (var j=1; j < xmlData[index].length; j++) {
var img = new Image();
$(img).load(function() {
$(this).hide();
$('#album'+index+' .photoContainer').append(this);
$(this).fadeIn();
})
.error(function(){
})
.attr({
'src': xmlData[index][j],
'id': 'img'+index+j,
'class': 'photoFrame',
'width': newW,
'height': newH
})
.css({
'width': newW,
'height': newH
});
};
};
Now, since you can see that all src images are imported from an external XML file containing data (image names are progressive ex.:photo001.jpg, photo002.jpg, etc.).
They are created in the DOM through a for loop and added to the div.
What problem can you say? I need all the images to be added in a progressive form, as indicated in the XML data, but this only happens on the local computer, and not when uploading to any server. I believe this is due to the different loading times of each image depending on the size ... but I still can’t understand how it works. Somebody knows?