JSFiddle - React, Tailwind, and code Playground
by Terry Young
HTML
<img width="120" height="60">
JavaScript
$('img').load(function () {
var $image = $(this),
_width = $image.width(),
_height = $image.height();
// reset to auto
$image
.css({
width: 'auto',
height: 'auto'
});
// get the natural width/height
var width = $image.width(),
height = $image.height();
console.log('Original', [_width, _height], 'Natural', [width, height]);
// restore
$image.css({
width: _width,
height: _height
});
})
.attr('src', 'http://images.google.com/intl/en_ALL/images/logos/images_logo_lg.gif?' + new Date().getTime())