///自适应图片大小调整
function imagewh(imgobj,mWidth,mHeight)
{
if(imgobj)
{
var maxHeight=mHeight;
var maxWidth=mWidth;
var image=new Image();
image.src=imgobj.src;
if(image.width>0 && image.height>0)
{
var rate=(maxWidth/image.width if(rate<=1)
{
imgobj.width=image.width*rate;
imgobj.height=image.height*rate;
}
else
{
imgobj.width=image.width;
imgobj.height=image.height;
}
}
}
}
自适应图片大小调整
最新推荐文章于 2024-07-13 03:29:06 发布