I have this code
var html = '';
data.forEach(function (item, index) {
html += '<img src="' + item.src + '">';
}
$('.container').append(html);
How do I wait until the images are preloaded before displaying them?
I saw something like that :
var img=new Image();
img.src=url;
But how do I know when the images have finished being preloaded in order to call the append() function ?