I have a jquery dialog box which contains an image (img). I am trying to set the height of the box to match the image but I am finding that both are being set smaller than I specify. For example, the following lines:
console.log("h1 " + $('#display').height());
$("#display").dialog('option', 'height', img.height);
console.log("h2 " + $('#display').height());
console.log("ih " + img.height);
produce the following output to the console:
h1 564
h2 564
ih 640
This suggests to me that $(‘#creativeImageDisplay’).height() refers to inner height but the ‘height’ in the options refers to outer height. Is there any way of setting inner height (such that outer height is increased correspondingly)?
Edit
('#display').outerHeight(true) 652
('#display').outerHeight(false) 652
('#display')innerHeight() 652
Just to be tidy.
Thank you for all of your helpful comments. It turned out the problem was that I had set the image position to ‘fixed’ which for some reason was preventing the auto resize from working.