Home  >  Article  >  Web Front-end  >  Detailed explanation of the use of the stop method of JQuery animation animate_jquery

Detailed explanation of the use of the stop method of JQuery animation animate_jquery

WBOY
WBOYOriginal
2016-05-16 16:49:111239browse

animate syntax:

Copy code The code is as follows:

$(selector).animate(styles, speed, easing, callback)

Copy code The code is as follows:





Testing











<script> <br>function moveX(){ <br>$('.wrap div') .animate({'left':'250px'},1000).animate({'left':'0px'},1000); <br>} moveX(); <br><br>$('#btn1 ').click(function(){ <br>$('.wrap div').stop(); // Stop the current animation and return to the starting point along the way. If you click again during the return process, it will pause on the way <br> clearInterval(); <br>}) <br><br>$('#btn2').click(function(){ <br>$('.wrap div').stop(true); // Stop everything Clicking to stop during the animation will reach the end point directly. If you click again during the return process, it will pause on the way <br>}) <br><br>$('#btn3').click(function(){ <br>$('.wrap div').stop(true,true); // Stop all animations. If you click stop during the journey, you will directly reach the end point. If you click again during the return process, it will stop at the starting point <br> }) <br><br>// .stop() // Stop the current animation <br>// .stop(true) // Stop all animations <br>// .stop(true,true) // Stop all Animation, reaching the end of animation <br></script>



.stop(); // Stop the current animation along the way Return to the starting point. If you click again during the return process, it will pause on the way.

.stop(true); // If you click Stop during the journey to stop all animations, you will directly reach the end point. If you click again during the return process, It will pause on the way

.stop(true,true); // Stop all animations. Clicking stop during the journey will directly reach the end point. If you click again during the return process, it will stop at the starting point.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn