I have an image tag, which I wish to resize in proportion using width() method after uploading an image as below;
$('img').imagesLoaded().done(function(){
tmp = $('#asd').width()*0.614;
$('img').width(tmp);
});
Problem is, the width of the element must be calculated with every upload, and the upload is repeatable. With the code above, starting from the second upload, the width is calculated from the width set by jQuery and not from the dimensions of the uploaded image.
I wish to "undo" or "reset" the width set by the width() method so it becomes dynamic by the uploaded image's dimensions. How do I do that?