JSFiddle - React, Tailwind, and code Playground
by roXon
HTML
Please wait...........
JavaScript
var size; // undefined var
function getMeta(url){
$('<img/>').attr('src', url).load(function(){
size = {w:this.width, h:this.height};
myDelayedFunction(); // so, our image is loaded and now run something!
});
}
getMeta("http://www.whitegadget.com/attachments/pc-wallpapers/16214d1222951839-nature-photos-wallpapers-images-beautiful-pictures-beautiful-nature-photos.jpg");
// The "run something" :D
function myDelayedFunction(){
$('body').text(
"Sorry for waiting but my image"+
"was loading cause it's "+ size.w +
"px wide and "+ size.h +"px tall !!!"
);
}