图片放大缩小,滚动鼠标

来源:互联网 发布:测光表测出的数据调整 编辑:程序博客网 时间:2024/04/29 02:45
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>通过鼠标滚轮放大缩小图片</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style1 {
color: #FF0000;
font-size: 16px;
}
-->
</style>
</head>
<script language="javascript">
function bigimg(i)
{
var zoom = parseInt(i.style.zoom,10)||100;
zoom += event.wheelDelta / 12;
if(zoom > 0 )
i.style.zoom=zoom+'%';
return false;
}
</script>
<body>
<table width="100%">
  <tr>
    <td><span class="style1">请滚动鼠标滚轮</span></td>
  </tr>
</table>
<center>
<a href="http://www.codefans.net">
<img src="http://www.codefans.net/jscss/demoimg/wall7.jpg" width="461" height="277" border="1" onmousewheel="return bigimg(this)">
</a>
</center>
</body>

</html>



需要<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.mousewheel.min.js"  charset="utf-8"></script>这个js

阅读全文
0 0