I checked other questions, but they all had information how to make a callback when one specific image has loaded:
var img = new Image();
img.src = "images/img.png";
if (!img.complete) {
img.onload = function() {
// code to be executed when the image loads
}
}
Or a simple check to see if all images are loaded with an 'if' statement. Also, $(window).load (or onLoad or whatever) doesn't work.
In my case I'm loading two images:
var img1 = new Image();
var img2 = new Image();
img1.src = 'images/img1.png';
img2.src = 'images/img2.png';
How can I define a callback similar to the one in the first example, but it gets executed when BOTH images have finished loading?
Thank you for your time.