Reputation: 1813
I have the width and the false height of a image and want calc a new proportional with Javascript/jQuery. Must use the width and calc the new height.
I hope anyone can help me.
Thanks!
Upvotes: 2
Views: 1401
Reputation: 778
Im using css width:100% and using element.clientHeight to get its height.
Upvotes: 1
Reputation: 631
var newWidth = <whatever the new width is>;
var width = $('#imgID').width();
var proportion = newWidth/width;
var newHeight = <existing height> * proportion;
Upvotes: 4