Rumah > Artikel > hujung hadapan web > 鼠标滚轮改变图片大小的示例代码_javascript技巧
鼠标滚轮改变图片大小的示例代码 src="http://files.jb51.net/file_images/article/201311/20131120101711.png" style="zoom:1;" onmousewheel='return onWheelZoom(this)'>
<script> <BR>function onWheelZoom(obj){ <BR> zoom = parseFloat(obj.style.zoom); <BR> tZoom = zoom + (event.wheelDelta>0 ? 0.05 : -0.05); <BR> if( tZoom > 1 || tZoom<0.1 ) return true; <BR> obj.style.zoom=tZoom; <BR> return false; <BR>} <BR></script>