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

鼠标滚轮放大缩小

时间:2015-01-06 22:49:21      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>练习1</title>
</head>
<style>
*{margin:0px;padding:0px;}
div{
width: 200px;
height: 200px;
margin: 0 auto;
margin-top: 99px;
background-color:#f60;
}
</style>
<script src="jquery-1.11.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
  $(function(){
  $(‘div‘).on(‘zoomOut‘,function(){  //放大
  $(this).stop().animate({width:"+=66px",height:"+=66px"},1000);
  });
  $(‘div‘).on(‘zoomIn‘,function(){     //缩小
  $(this).stop().animate({width:"+=-66px",height:"+=-66px"},1000);
  });
  $(‘div‘).on(‘DOMMouseScroll‘,function(ev){
  //alert(ev.originalEvent.detail)
  if(ev.originalEvent.detail < 0){
   
   $(‘div‘).trigger(‘zoomOut‘);
  }else if(ev.originalEvent.detail > 0){
  $(‘div‘).trigger(‘zoomIn‘);
  }
  });
  })
</script>
<body>
<div></div>
</body>
</html>

鼠标滚轮放大缩小

标签:

原文地址:http://www.cnblogs.com/mrjie/p/4207108.html

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