码迷,mamicode.com
首页 > Web开发 > 详细

js控制图片放大缩小的简易版

时间:2017-10-20 13:33:56      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:ret   +=   代码   logs   this   return   move   col   sel   

js代码:

function bb_img_onmousewheel(e, o) {
    var zoom = parseInt(o.style.zoom, 10) || 100;
    zoom += event.wheelDelta / 12;
    if (zoom > 0) o.style.zoom = zoom + ‘%‘;
    return false;
}

图片html标签:

<img onmousedown="if(self.startMove)startMove(this,event)" onmousewheel="return bb_img_onmousewheel(event,this)" style="cursor: move; zoom: 80%;" src="" width="600px" />

 

js控制图片放大缩小的简易版

标签:ret   +=   代码   logs   this   return   move   col   sel   

原文地址:http://www.cnblogs.com/Alex-zqzy/p/7698824.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!