JQuery动画animate的stop方法使用详解
2014-05-09 00:00
1371 查看
animate语法:
.stop(); // 停止当前动画,沿路返回起点,若是返回过程中再点击,会暂停在路中
.stop(true); // 停止所有动画 去的路程中点击停止会直接到达终点,若是返回过程中再点击,会暂停在路中
.stop(true,true); // 停止所有动画 ,去的路程中点击停止会直接到达终点,若是返回过程中再点击,会停止到在起点
$(selector).animate(styles,speed,easing,callback)
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Testing</title> <link rel="stylesheet" href="css/reset.css"> <script src="js/jquery.js"></script> <style> .wrap { position: relative; height: 300px; width: 300px; border:5px solid #FCF; } .wrap div { position: absolute; left: 0;top: 0; height: 50px; width: 50px; background: #FA0; } </style> </head> <body> <input type="button" id="btn1" value="停止当前动画"> <input type="button" id="btn2" value="停止所有动画"> <input type="button" id="btn3" value="停止所有动画,到达终点"> <div class="wrap"> <div></div> </div> <script> function moveX(){ $('.wrap div').animate({'left':'250px'},1000).animate({'left':'0px'},1000); } moveX(); $('#btn1').click(function(){ $('.wrap div').stop(); // 停止当前动画,沿路返回起点,若是返回过程中再点击,会暂停在路中 clearInterval(); }) $('#btn2').click(function(){ $('.wrap div').stop(true); // 停止所有动画 去的路程中点击停止会直接到达终点,若是返回过程中再点击,会暂停在路中 }) $('#btn3').click(function(){ $('.wrap div').stop(true,true); // 停止所有动画 ,去的路程中点击停止会直接到达终点,若是返回过程中再点击,会停止到在起点 }) // .stop() // 停止当前动画 // .stop(true) // 停止所有动画 // .stop(true,true) // 停止所有动画,到达动画终点 </script> </body> </html>
.stop(); // 停止当前动画,沿路返回起点,若是返回过程中再点击,会暂停在路中
.stop(true); // 停止所有动画 去的路程中点击停止会直接到达终点,若是返回过程中再点击,会暂停在路中
.stop(true,true); // 停止所有动画 ,去的路程中点击停止会直接到达终点,若是返回过程中再点击,会停止到在起点
相关文章推荐
- JQuery动画animate的stop方法使用详解
- JQuery动画animate的stop方法使用详解
- 详解jQuery停止动画――stop()方法的使用
- 转载:jQuery停止动画——stop()方法的使用
- jQuery animate easing使用方法图文详解
- jquery中的动画效果方法animate()及其回调函数的使用
- jQuery中使用animate自定义动画的方法
- jQuery动画animate方法使用介绍
- jQuery动画animate方法使用介绍
- JQuery中的方法链及定时函数的使用,animate动画
- jQuery动画animate方法使用介绍
- jQuery动画animate方法使用介绍
- jQuery动画效果animate和scrollTop结合使用实例
- jQuery的remove()方法使用详解
- jQuery实现基本动画效果的方法详解
- 超棒的跨浏览器纯CSS动画实现 Animate.css使用方法
- jQuery使用contains过滤器实现精确匹配方法详解
- jQuery树插件zTree使用方法详解
- jQuery动画效果animate和scrollTop结合使用实例