返回stop()方......登陆

stop()方法的使用案例

风轻云淡2018-12-29 11:18:35344

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>自定动画</title>

<script type="text/javascript" src="jquery-3.3.1.min.js"></script>

<style type="text/css">

.box{width: 200px;height: 200px;background: red;position: absolute;}

</style>

</head>

<body>

<script type="text/javascript">

$(document).ready(function(){

$('.bt1').click(function(){

$('.box').animate({left:'+200px'},3000)

$('.box').animate({fontSize:'40px'},500)

})

  $('.bt2').click(function(){

$('.box').stop(true)

})

})

 

</script>

<button class="bt1">右移</button>

<button class="bt2">停止</button>

<div class="box">早安~~~</div>


</body>

</html>

总结:stop()内部参数的作用:stop(true)停止所有动画,stop(true,true)直接结束动画跳到最后。

最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送