I need to load 2 or more images off screen and display them with a transition only when all of them are loaded.
I'm having some issues with load() Here is my function it shows a div with a loading message, when the img is loaded it hide the loadig message and call a function with the visual transition (transizione();)
function load_img(sezione) {
if (sezione==1) {sfondo = "sfondo2.jpg"; footer = "footer1.jpg";}
else if (sezione==2) {sfondo = "sfondo3.jpg"; footer = "footer2.jpg";}
else if (sezione==3) {sfondo = "sfondo4.jpg"; footer = "footer3.jpg";}
else if (sezione==4) {sfondo = "sfondo5.jpg"; footer = "footer4.jpg";}
$("#loading").fadeIn();
$("#sfondo2").load(function () {
$("#loading").hide();
transizione();
}).attr('src', 'img/'+sfondo);
}
How can I modify it to call 2 images? I'm a bit confused with how load() works for images
Thanks
Giuseppe