jQuery实现鼠标滚轮控制图片缩放

  <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
  <htmlxmlns="http://www.w3.org/1999/xhtml">
 
  <head>
 
  <metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
 
  <title>www.jb51.net鼠标滚轮控制图片缩放</title>
 
  <scripttype="text/javascript"src="jquery-1.7.2.min.js"></script>
 
  <scripttype="text/javascript">
 
  $(function(){
 
  functionzoomImg(o){
 
  varzoom=parseInt(o.style.zoom,10)||100;
 
  zoom+=event.wheelDelta/2;//可适合修改
 
  if(zoom>0)o.style.zoom=zoom+'%';
 
  }
 
  $(document).ready(function(){
 
  $("img").bind("mousewheel",
 
  function(){
 
  zoomImg(this);
 
  returnfalse;
 
  });
 
  });
 
  })
 
  </script>
 
  </head>
 
  <body>
 
  <center>
 
  <imgsrc="1.webp"/>
 
  </center>
 
  </body>
 
  </html>





本文转载自中文网

 

推荐阅读