欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

JS 图片缩放效果代码

程序员文章站 2022-07-04 12:40:58
复制代码 代码如下:
复制代码 代码如下:

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>onmousewheel</title>
<script>
var count = 10;
function picture()
{
count = counting(count);
resize(count);
return false;
}
function counting(count){
if (event.wheeldelta >= 120)
count++;
else if (event.wheeldelta <= -120)
count--;
return count;
}
function resize(count){
oimage.style.zoom = count + '0%';
ocounter.innertext = count + '0%';
}
</script>
</head>
<body>
<div align=center>
<span style="font-weight:bold">size =
<span id="ocounter" style="color:red;">100%</span></span>
<img id="oimage" src="images/aaa.gif" onmousewheel="return picture();" >
</div>
</body>
</html>