linhaisheng

jQuery实现基本动画效果的方法详解

Html:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
</head>
<style>
body{
padding: 0;
margin: 0;
}
.box{
display: block;
position: fixed;
width: 200px;
height: 200px;
background: #ccc;
}
button{
margin-top: 250px;
}
</style>
<body>
<div class="box">

</div>
<button>开始</button>
</body>
<script>
$(function(){
$(document).on("click","button",function(){
$(".box").removeAttr("style");
$(".box").animate({
"right":"0",
"bottom":"50px"
},1000);

$(".box").animate({
"top":"0px"
},1000);

$(".box").animate({
"left":"0px"
},1000);

setTimeout(function() {
$(".box").removeAttr("style");
}, 3100)
})
})
</script>
</html>

 

注意:记得引入jQuery.js文件

分类:

技术点:

相关文章:

  • 2021-10-19
  • 2021-11-20
  • 2021-08-16
  • 2021-11-29
  • 2021-12-23
  • 2021-06-15
  • 2021-12-13
  • 2021-11-20
猜你喜欢
  • 2021-11-17
  • 2021-11-27
  • 2021-08-28
  • 2021-07-05
  • 2021-06-28
  • 2021-08-03
  • 2021-07-18
  • 2022-01-21
相关资源
相似解决方案