JSFiddle - React, Tailwind, and code Playground
HTML
<div id="glykopeels" onload="loadImage()">Glykopeels Content</div>
<div id="facials" onload="loadImage2()">Facials Content</div>
CSS
#glykopeels{
background: #ebebeb url(http://lamininbeauty.co.za/images/products/loader.gif) no-repeat top right;
background-size: contain;
height: 200px;
}
#facials{
background: #ebebeb url(http://lamininbeauty.co.za/images/products/loader.gif) no-repeat top right;
background-size: contain;
height: 200px;
}
JavaScript
function loadImageToBackground(elementId, imageUri) {
var img = new Image();
img.onload = function() {
document.getElementById(elementId).style.backgroundImage = "url('" + imageUri + "')";
};
img.src = imageUri;
}
loadImageToBackground('glykopeels', 'http://www.fringedigital.com/wallpaper/hg2g_v1_ipad_retina_lock.jpg');
loadImageToBackground('facials', 'http://www.deviantart.com/download/288664004/marvin_by_hugolynch-d4rv2kk.png');