页面图片放大缩小倍数

方法放在最上面




function ReSizePic(ThisPic){
    var RePicWidth = 50; //这里修改为您想显示的宽度值
    //============以下代码请勿修改==================================
    var TrueWidth = ThisPic.width;    //图片实际宽度
    var TrueHeight = ThisPic.height;  //图片实际高度
    var Multiple = TrueWidth / RePicWidth;  //图片缩小(放大)的倍数

    ThisPic.width = RePicWidth;  //图片显示的可视宽度
    ThisPic.height = TrueHeight / Multiple;  //图片显示的可视高度
}

图片标签调用方法即可

方法转自他人,但是忘记哪位的链接,如若看到,还望莫怪,先道声抱歉!!!

猜你喜欢

转载自blog.csdn.net/qq_39900178/article/details/83899018