关于图片滚动放大

阅读 41

2023-06-26


前面写过一篇关于滚轴的兼容,有兴趣移步这里:http://zhangyaochun.iteye.com/blog/1187536

 

本文不是谈这个,而是在万网上的一个小小应用:

 

先上代码:

 

<img onmousewheel = "return bbimg(this)" οnlοad="javascript:resizepic(this)" />

 



function bbimg(o){
      var zoom = parseInt(o.style.zoom,10) || 100;

      zoom += event.wheelDetla / 12;

      if(zoom > 0){
            o.style.zoom = zoom + '%';
      }  

       return false;
}



 


function resizepic(thispic){
      if(thispic.width > 700){
           thispic.width = 700;
      }
}


 

精彩评论(0)

0 0 举报