Hi I'm using this code to preload some images that I use as a background for some divs.
I visualized the chrome console and actually the preload works but it seems to me that anyway when I start the application there is a flickering on the div in question, as if the call of the image css was independent of the preload made of it.
It is my impression? did I miss anything in the preload method?
in jquery i use:
$(window).load(function () {
let p_url = cc_object.p_url;
p_url = p_url + '/public/images/';
let cache = [];
$.preLoadImages = function () {
let args_len = arguments.length;
for (let i = args_len; i--;) {
let cacheImage = document.createElement('img');
cacheImage.src = arguments[i];
cache.push(cacheImage);
}
};
$.preLoadImages(
p_url + "dorso.png",
p_url + "t-z-amore-bg.jpg"
);
});
while in css:
.cont_game {
background: url(../images/t-z-amore-bg.jpg) no-repeat center center;
}
.cont_game .carta_estratta.empty {
background: url(../images/dorso.png) no-repeat center center;
}
you can see it in action at https://www.casadeicartomanti.it/tarocchi/tarocchi-online/