鼠标滚轮控制图片缩放

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

    <title>无标题页</title>

</head>

<body>

<script type="text/javascript">

    function rollImg(obj) {

        var zoom = parseInt(obj.style.zoom, 10) || 100; zoom += event.wheelDelta / 12; if (zoom > 0) obj.style.zoom = zoom + '%';

        return false;

    }

    

</script>

    <form id="form1" runat="server">

    <div>

    <img src="img/5.jpg" onload="javascript:if(this.width>screen.width*0.5)this.style.width=screen.width*0.5;"onmousewheel="return rollImg(this)" style="cursor:hand;"/>

    </div>

    </form>

</body>

</html>

原文地址:https://www.cnblogs.com/cyan/p/1271373.html