- <script>
- function imgzoom(o){
- var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0)
- o.style.zoom=zoom+'%';
- return false;
- }
- var dragapproved=false
- function drag_dropie(){
- if (dragapproved==true){
- document.all.showimage.style.pixelLeft=tempx+event.clientX-iex
- document.all.showimage.style.pixelTop=tempy+event.clientY-iey
- return false
- }
- }
- function initializedragie(){
- if (event.srcElement.parentElement.id=="showimage"){
- iex=event.clientX
- iey=event.clientY
- tempx=showimage.style.pixelLeft
- tempy=showimage.style.pixelTop
- dragapproved=true
- document.onmousemove=drag_dropie
- }
- }
- if (document.all){
- document.onmousedown=initializedragie
- document.onmouseup=new Function("dragapproved=false")
- }
- </script>
<IMG> 中加上 onmousewheel="return imgzoom(this);" 就行了

本文介绍了一个简单的JavaScript脚本,该脚本允许用户通过鼠标滚轮缩放页面上的图片,并通过鼠标拖动来调整图片位置。此功能增强了用户体验,尤其是在查看详细图像时。
2785

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



