I am setting background image on div:
div.css('background-image', 'url("' + imageSrc+ '")')
But I also need to get image dimensions, so I need to load this image again:
var image = new Image();
image.src = imageSrc;
image.onload = function () {
var width = image.width,
height = image.height;
};
Does this mean this image is loading twice and its not cached as well? Is there a different way to prevent this?