JSFiddle - React, Tailwind, and code Playground
by Ben Watts
HTML
<div class="imageHolder">
<img class="imagePlaceHolder" src="https://placehold.it/300/09f.png/fff" data-realsrc="http://architecturediary.org/uploads/events/1431300113_LFA_2015_LAD_Image_Placeholders-01_1.jpg" />
</div>
JavaScript
$(function () {
$('.imagePlaceHolder').load(function () {
var $this = $(this);
var newSrc = $(this).data('realsrc');
var image = $("<img>");
$('.imagePlaceHolder').removeClass('imagePlaceHolder');
image.attr("src", newSrc);
image.load();
setTimeout(function(){ $this.replaceWith(image); }, 300);
});
});