I have an image
thats height
is 100%
of the browser and width
is auto
. So the width can vary depending on the picture and the resolution of your screen.
So, I want to calculate the width in the browser thats not taken up by the image.
.main-image img {
width:auto
}
var winheight = $(window).height();
$('.main-image img').css('height', winheight);
So, I was thinking about doing something like this but it wont work.
var findimage = $('.main-image img');
var imagewidth = findimage.clientHeight;
console.log("image width is " + imagewidth);
However, this returns
"image width is undefined
". What should I do?