码迷,mamicode.com
首页 > 其他好文 > 详细

鼠标滚轮改变图片大小

时间:2017-06-30 00:01:34      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:zoom   window   oct   改变   nbsp   code   his   wal   order   

<!DOCTYPE html">
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>通过鼠标滚动-放大缩小图片</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style>
    img{
        zoom: 100%;
    }
</style>
</head>
<script language="javascript">
    function bigimg(i)
    {
        var e=e || window.event;//window.event代表着事件对象的状态.只有在事件发生时生效

        var zoom = parseInt(i.style.zoom,10)||100;

        zoom += e.wheelDelta / 12;
        if(zoom > 0 )
        i.style.zoom=zoom+%;
        return false;
    }
</script>
<body>
<h3>请滚动鼠标滚轮-火狐浏览器不兼容</h3>
<center>
    <a target="_blank">
        <img src="img/wall7.jpg" width="461" height="277" border="1" onmousewheel="return bigimg(this)">
    </a>
</center>


</body>
</html>

 

鼠标滚轮改变图片大小

标签:zoom   window   oct   改变   nbsp   code   his   wal   order   

原文地址:http://www.cnblogs.com/lubenxin/p/7096526.html

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