if I have images defined in my css like this:
@media only screen and (min-width: 480px) {
/* ==========================
Responsive Image handler
========================== */
.slide1 {background-image: url(../img/rect-img/slide1-small.jpg);}
.slide2 {background-image: url(../img/rect-img/slide2-1-small.jpg);}
.slide4 {background-image: url(../img/rect-img/slide2-2-small.jpg);}
.slide5 {background-image: url(../img/rect-img/slide2-3-small.jpg);}
.slide6 {background-image: url(../img/rect-img/slide2-4-small.jpg);}
.slide7 {background-image: url(../img/rect-img/slide2-5-small.jpg);}
.slide8 {background-image: url(../img/rect-img/slide2-6-small.jpg);}
.slide9 {background-image: url(../img/rect-img/slide2-7-small.jpg);}
.slide10 {background-image: url(../img/rect-img/slide2-8-small.jpg);}
.slide11 {background-image: url(../img/rect-img/slide2-9-small.jpg);}
.slide12 {background-image: url(../img/rect-img/slide2-10-small.jpg);}
.slide3 {background-image: url(../img/rect-img/slide3-1-small.jpg);}
.slide13 {background-image: url(../img/rect-img/slide3-1-small.jpg);}
.slide14 {background-image: url(../img/rect-img/slide3-1-small.jpg);}
.slide15 {background-image: url(../img/rect-img/slide3-1-small.jpg);}
}
and I created a precache code on JQuery but now that i am doing this now I don't know or don't understand which one will load first. Here is the code: $(document).ready(function() {
var imageArray = [
[
'img/rect-img/slide2-1-small.jpg',
'img/rect-img/slide2-1-medium.jpg',
'img/rect-img/slide2-1-large-medium.jpg',
'img/rect-img/slide2-1-large.jpg'
],
[
'img/rect-img/slide3-1-small.jpg',
'img/rect-img/slide3-1-medium.jpg',
'img/rect-img/slide3-1-large-medium.jpg',
'img/rect-img/slide3-1-large.jpg'
],
]
function preCacheHeros(images){
$.each(imageArray[images], function(){
var img = new Image();
img.src = this;
})
};
preCacheHeros(0);
all the app is based on giant background images, so I want to preload images depending on where you are in the app.