jQuery停止动画finish和stop函数区别
2017-09-15 00:00
295 查看
stop()函数直接停止动画,finish()也会停止动画同时所有排队的动画的CSS属性跳转到他们的最终值。
示例代码:
说明:
示例中stop()函数没有停止动画,为什么?
示例代码:
<html> <head> <meta charset="UTF-8" /> <title>jQuery停止动画finish和stop函数区别</title> <style type="text/css"> div { border: 1px solid green; width: 200px; height: 200px; line-height: 200px; text-align: center; } </style> <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js "></script> </head> <body> <button type="button" id="start">start</button> <button type="button" id="start">stop</button> <button type="button" id="finish">finish</button> <div class=""> 动画 </div> <script type="text/javascript"> $(document).ready(function() { $("#start").click(function() { $("div").animate({ width: '1800px' }, 3000); }); $("#stop").click(function() { //停止当前正在运行的动画, width: '+=100px'可以停止 //停止当前正在运行的动画 width: '1800px'不能停止 $("div").stop(); }); $("#finish").click(function() { //停止当前正在运行的动画 width: '+=100px'可以停止 //停止当前正在运行的动画 width: '1800px'可以停止,并且停止在最后一帧 $("div").finish(); }); }); </script> </body> </html>
说明:
示例中stop()函数没有停止动画,为什么?
相关文章推荐
- Jquery----停止动画stop
- jQuery停止动画finish和stop函数区别
- Jquery动画操作的stop()函数
- jquery 停止动画 stop的几种用法
- jquery 动画 鼠标移上多次 移走后它还在不停的展开 用stop停止动画
- jQuery学习教程八: jQuery 停止动画stop
- jquery中stop停止动画笔记
- 【jQuery】stop( ) 停止动画
- jQuery动画效果2(animate移位效果/stop停止/delay延时效果)
- 详解jQuery停止动画――stop()方法的使用
- 转载:jQuery停止动画——stop()方法的使用
- jQuery中停止动画stop
- jquery 停止动画 stop的几种用法
- jQuery 停止动画 stop()
- 【jQuery】调用stop()方法停止当前所有动画效果
- jQuery stop() 方法停止当前正在运行的动画。
- jQuery动画函数
- jquery动画相关函数
- jQuery动画高级用法(上)——详解animation中的.queue()函数
- jQuery 停止动画