自定义动画就是通过 jQuery 提供的方法来完成我们自己想要的动画效果
话不多说,直接上代码
首先插入一个js
<script src="js/jquery-3.6.0.min.js"></script>
css代码
<style type="text/css">
div{
width: 200px;
height: 200px;
background-color: aqua;
position: absolute;
}
</style>
html代码
<input type="button" value="自定义动画" id="btn0">
<hr>
<div>自定义动画</div>
<script type="text/javascript">
$(function(){
$("#btn0").on("click",function(){
$("div").animate({
"left":"500px"
}).animate({
"top":"400px"
}).animate({
"left":"0"