JSFiddle - React, Tailwind, and code Playground
HTML
<div id="placeForImg"></div>
JavaScript
$(document).ready(function(){
var height = 0;
var diffDate;
var placeForImg = $('#placeForImg');
var startDate = new Date().getTime();
placeForImg.html('<img src="http://www.zastavki.com/pictures/originals/2013/Animals___Cats_Scottish_Fold_cat_with_brown_eyes_045188_.jpg">');
var newDateAppend = new Date().getTime();
var diffDateAppend = newDateAppend - startDate;
var heightAppend = placeForImg.height();
console.log('time after append: ' + diffDateAppend + ' height: ' + heightAppend);
setInterval(function(){
if (height < 3000) {
newDate = new Date().getTime();
diffDate = newDate - startDate;
height = placeForImg.height();
console.log('time in loop: ' + diffDate + ' height: ' + height);
}
},10);
$('#placeForImg img').load(function() {
var newDate = new Date().getTime();
var diffDateLoad = newDate - startDate;
var heightLoad = placeForImg.height();
console.log('time load: ' + diffDateLoad + ' height: ' + heightLoad);
});
});