码迷,mamicode.com
首页 > Web开发 > 详细

js的animate动画

时间:2016-06-15 01:41:03      阅读:701      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head>
<script src="/jquery/jquery-1.11.1.min.js">
</script>
<script>
$(document).ready(function(){
$(".start").click(function(){
$("div").animate({
left:‘500px‘,
opacity:‘0.5‘,
height:‘300px‘,
width:‘50px‘
},"slow",function(){
alert("animate动画效果的实现");
});
});
$(".reset").click(function(){
if(confirm("想恢复原样吗?")){
$("div").animate({
background:‘#98bf21‘,
height:‘100px‘,
width:‘100px‘,
position:‘absolute‘});
}
});
});
</script>
</head>

<body>

<button class="start">开始动画</button>
<button class="reset">恢复动画</button>
<p>默认情况下,所有 HTML 元素的位置都是静态的,并且无法移动。如需对位置进行操作,记得首先把元素的 CSS position 属性设置为 relative、fixed 或 absolute。</p>
<div style="background:#98bf21;height:100px;width:100px;position:absolute;">
</div>

</body>
</html>

js的animate动画

标签:

原文地址:http://www.cnblogs.com/shunzdd/p/5585976.html

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