53 jQuery-animate()方法

版权声明:本文为大都督作者的原创文章,未经 大都督 允许也可以转载,但请注明出处,谢谢! 共勉! https://blog.csdn.net/qq_37335220/article/details/85684066

1.效果图

在这里插入图片描述

2.HTML代码

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <title>53 jQuery-animate()方法</title>
    <style type="text/css">
          .divFrame{border:solid 1px #ccc;background-color:#eee;
          width:60px;height:50px;
          font-size:13px;padding:5px}
   </style>
</head>
<body>
	 <div class="divFrame">
          	点击变大
     </div>
	
              
<script src="../jquery.min.js"></script>
<script type="text/javascript">
	$(function(){
		//div元素点击事件
		$(".divFrame").click(function(){
			//宽与高变化的动画效果
			$(this).animate({width:"20%", height:"70px"}, 3000, function(){//动画完成时执行的一个回调函数
				$(this).css({"border":"solid 3px #666"}).html("变大了");
			})
		})
	})
</script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/qq_37335220/article/details/85684066
53
今日推荐