This article describes the method of implementing the mouse scroll wheel to control the image scaling effect. Share it for your reference. The specific implementation method is as follows:
Copy the code as follows:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="zh-cn" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" >
<title>Calling the image with the mouse wheel scrolling</title>
<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>
</head>
<body>
<p>Put the mouse on the picture, click it, and then scroll the mouse wheel to try it</p>
<p><img src="/images/m01.jpg" onmousewheel="return bbimg(this)"></p>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>
I hope this article will be helpful to everyone's JavaScript programming.