Preload images event --> Problem with multiple
Hello everybody!
I have script which is preloading chosen image and after finish can make some event.
But preloading is working only for one image..
- var $src1 = $('#image').data('src1');
$('<img>').attr('src', $src1).load(function() {
$(this).remove();
$('#loading').hide();
$('body').append('<img src="' + $src1 + '" width="200"">');
});
If I create another
var (for example to take data from
src2 ), and put it to function like this:
- $('<img>').attr(src: $src1, src: $src2).load(function() {
it always loads only last element. The first element starts loading normally.
I have dirty solution: wrap two functions which works, but....
Any idea how to make it?
Here is sample:
LINK