1. 程式人生 > >js圖片拖拽檢視並滑動滑鼠可放大縮小

js圖片拖拽檢視並滑動滑鼠可放大縮小

<style type="text/css"> body{background-color:#555;color:#fff;} a img{border:none;} #imageView_container{border:2px solid #000;margin:0 auto;} #imageView_container.iv-loading{border:2px solid #ff6600;} </style> </head> <body> <div id="imageView_container"> <img src="images/sad2.jpg" rel="images/sad2.jpg" alt="" onmousewheel="return bbimg(this)"/> </div> </body> </html> js程式碼: <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.imageView.js"></script>下載並引用 $(function() { $('#imageView_container').imageView({width:850, height:708}); }); <script language="javascript"> function bbimg(o){  var zoom=parseInt(o.style.zoom, 10)||100; zoom+=event.wheelDelta/12; if (zoom>0) o.style.zoom=zoom+'%'; return false; } </script> ok