46 rivejä
1.6 KiB
Plaintext
46 rivejä
1.6 KiB
Plaintext
|
|
<script>
|
|
Z.onload(function()
|
|
{
|
|
var img = document.getElementById("bigimg");
|
|
//Z.EL.set(img, "src", "258969-0-endFile")
|
|
|
|
var windowW = window.screen.width;//获取当前窗口宽度
|
|
var windowH = window.screen.height;//获取当前窗口高度
|
|
|
|
var realWidth = img.width;//获取图片真实宽度
|
|
var realHeight = img.height;//获取图片真实高度
|
|
var imgWidth, imgHeight;
|
|
var scale = 0.8;//缩放尺寸,当图片真实宽度和高度大于窗口宽度和高度时进行缩放
|
|
|
|
if (realHeight>windowH*scale)
|
|
{//判断图片高度
|
|
imgHeight = windowH*scale;//如大于窗口高度,图片高度进行缩放
|
|
imgWidth = imgHeight/realHeight*realWidth;//等比例缩放宽度
|
|
if (imgWidth>windowW*scale)
|
|
{//如宽度扔大于窗口宽度
|
|
imgWidth = windowW*scale;//再对宽度进行缩放
|
|
}
|
|
} else if (realWidth>windowW*scale)
|
|
{//如图片高度合适,判断图片宽度
|
|
imgWidth = windowW*scale;//如大于窗口宽度,图片宽度进行缩放
|
|
imgHeight = imgWidth/realWidth*realHeight;//等比例缩放高度
|
|
} else
|
|
{//如果图片真实高度和宽度都符合要求,高宽不变
|
|
imgWidth = realWidth;
|
|
imgHeight = realHeight;
|
|
}
|
|
//img.setAttribute(imgWidth);
|
|
});
|
|
|
|
function closeDialog()
|
|
{
|
|
parent.Z.Dialog.close();
|
|
}
|
|
</script>
|
|
<div class="z-pointer" style="" onclick="parent.Z.Dialog.close();" >
|
|
<div class="z-text-center z-mg-t20 z-mg-b20">
|
|
<img class="z-pointer" id="bigimg" style="vertical-align:middle;border:2px solid #fff;width:auto;height:auto" src="${imgpath}" />
|
|
</div>
|
|
</div>
|