<!--呵呵上网偶尔发现的,叫风云舞修改了一下做成了例子,作用及如何操作可以看IMG的title属性,注意,只有"带对滚轮的鼠标有效"-->
<img src=' http://www.lshdic.com/bbs/image/mu.jpg' onmousewheel='alert("滚轮值"+event.wheelDelta)' onclick='this.style.zoom=parseInt(this.style.zoom)+1' oncontextmenu='this.style.zoom=parseInt(this.style.zoom)-1;return false'id=a style='position:absolute;zoom:1' title='左键单击放大1倍,右键单击缩小1倍,鼠标滚轮控制'>
<script>
top1=0;
function document.onmousewheel(){
if(event.wheelDelta>0)top1-=10;else top1+=10
a.style.top=top1
}
</script>
<img src=' http://www.lshdic.com/bbs/image/mu.jpg' onmousewheel='alert("滚轮值"+event.wheelDelta)' onclick='this.style.zoom=parseInt(this.style.zoom)+1' oncontextmenu='this.style.zoom=parseInt(this.style.zoom)-1;return false'id=a style='position:absolute;zoom:1' title='左键单击放大1倍,右键单击缩小1倍,鼠标滚轮控制'>
<script>
top1=0;
function document.onmousewheel(){
if(event.wheelDelta>0)top1-=10;else top1+=10
a.style.top=top1
}
</script>
本文介绍了一种使用JavaScript处理鼠标滚轮、左键点击和右键点击事件的方法,实现图片的动态缩放功能。通过简单的HTML和JavaScript代码示例,展示了如何响应用户的交互并改变图片的缩放级别。
820

被折叠的 条评论
为什么被折叠?



