以下是我的图片:http://cameronlimbrick.com/work/visual-art/paintings/item/thoughts
我想保持现有的最大高度,但是,当窗口不够高以适应整个图像时,我希望它自动缩小以适应高度。谢谢你的帮助。
答案 0 :(得分:1)
你可以尝试
img.your-image-class {
height: 100%; //automatically retains aspect ratio
max-height: 755px; //don't let it get bigger than this (755px is its current height I checked your link
}
答案 1 :(得分:1)
它应该有效!
$(document).ready(){
var h = $(window).height();
if (h < 755)
{
$('.img.your-image-class').css("max-height",h + "px")
}
}