stop()方法的使用案例

Original 2018-12-29 11:18:35 344
abstract:<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>自定动画</title> <script type="text/javascript" src="jquery-3.3.1.min.js">

<!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)直接结束动画跳到最后。

Correcting teacher:天蓬老师Correction time:2018-12-29 11:21:40
Teacher's summary:<script type="text/javascript" src="jquery-3.3.1.min.js"></script>, 以后不要加type属性了

Release Notes

Popular Entries