I have a background image that I am preloading and caching, but my code is not reading it from the cache. It keeps loading the image as if it is not cached. Even though I have 8 images in the "imgSrcArray," I have simplified this example by hard coding just one.
Does anyone have any suggestions?
imgSrcArray = ["images/img0"];
//preload image
$.each(imgSrcArray, function (i, val) {
$(function() {
$(document.body).append($("<img id='imgHid" + i + "'/>").attr("src", val).hide())
});
});
$(document).ready(function(){
$('#bkgrnddiv').css('backgroundImage', 'url(images/img0)');
});