天天看点

js鼠标滚轮放大缩小图片

function bigimg(obj){

var zoom = parseInt(obj.style.zoom,10)||100;

zoom += event.wheelDelta / 12;

if(zoom > 0 )

obj.style.zoom=zoom+'%';

return false;

}

使用方法

<img id="chgImg" src="'你的图片地址'" width="760" onmousewheel="return bigimg(this)" style="cursor:pointer" />