<script type=”text/javascript”>
function wheel_zoom_img(id){
 var tu = document.getElementById(id);
 tu.onmousewheel = f;
 try {
  tu.addEventListener(\’DOMMouseScroll\’,f,false);
 }
 catch(e){}
 function f(){
  sctop = document.documentElement.scrollTop;
  var Firefox = navigator.userAgent;
  if(Firefox.indexOf(“Firefox”) == -1) {
   var aa = event.wheelDelta;
  }
  else {
   var aa = arguments[0].detail;
   aa = -aa;
  }
  if(aa>0) {
   tu.width = tu.offsetWidth*1.05;
   tu.height = tu.offsetHeight*1.05;
   document.documentElement.scrollTop = sctop;
  }
  if(aa<0) {
   if(this.offsetWidth<50||this.offsetHeight<50) {
    return;
   }
   tu.width = tu.offsetWidth/1.05;
   tu.height = tu.offsetHeight/1.05;
   document.documentElement.scrollTop = sctop;
  }
 }
}

window.onload = function() {
 wheel_zoom_img(“tu0”);
}
</script>
</head>
<body>
<img src=”yw.jpg” id=”tu0″ />

 

版权声明:本文为RIVERSPIRIT原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/RIVERSPIRIT/articles/1636367.html