根據瀏覽器的視窗大小來定圖片的高度
阿新 • • 發佈:2019-01-24
html:
<span class="dw-xd"> <img alt="[field:alttext /]" title="[field:alttext /]" class="shijue-idea-img" style="max-width: 1140px; display: block;margin: 0 auto;" src="[field:imgsrc/]" id="bigImg"> <a href="[field:linkurl/]" class="view-bigshow" title="[field:title /]" target="_blank">[field:title /]</a> </span>
js:
<script type="text/javascript">
// 根據視窗高度來設定圖片的高度
var screenHeight = $(window).height();
height = screenHeight-140;
$("#bigImg").css("max-height",height);
</script>