Detailed explanation of usage examples of stop() in jquery
Jun 30, 2017 am 11:34 AMstop is the method used in jQuery to control page animation effects. Immediately after running, end the animation effect on the current page.
stop has added two parameters in the new version of jQuery:
The first parameter means whether to clear the animation sequence, that is, whether to stop the animation effect of the current element or to stop all animation effects attached to it, usually false, skip the current animation effect and execute the next animation effect;
The second parameter is whether to execute the current animation effect to the end, which means that when stopping the current animation, the animation effect has just been executed. Normally, what you want at this time It is the effect after the animation is executed, then this parameter is true. Otherwise the animation effect will stop when stop is executed
HTML code
<p id="animater"> stop()方法测试 </p> <p id="button"> <input type="button" id="button1" value="stop()"/> <input type="button" id="button2" value="stop(true)"/> <input type="button" id="button3" value="stop(false,true)"/> <input type="button" id="button4" value="stop(true,true)"/> </p>
CSS code
#animater{ width: 150px; background:activeborder; border: 1px solid black; /*为了移动,需设置此属性*/ position: relative; }
jquery code
// 为了看效果,随意写的动画 $('#animater').animate({ 'right':-800 }, 3000).animate({'font-size':'16px'},'normal').animate({'font-size':'26px'},'normal').animate({'font-size':'36px'},'normal').animate({'font-size':'46px'},'normal').animate({'font-size':'56px'},'normal').animate({'opacity':0},'normal').animate({'opacity':1},'normal').animate({'left':200,'font-size':'16px'},'normal'); // 点击不同的button执行不同的操作 $('#button1').click(function(){ //默认参数是false,不管写一个false还是两个false还是没写false效果一样 $('#animater').stop(); }); $('#button2').click(function(){ //第二个参数默认false $('#animater').stop(true); }); $('#button3').click(function(){ $('#animater').stop(false,true); }); $('#button4').click(function(){ $('#animater').stop(true,true); });
The above is the detailed content of Detailed explanation of usage examples of stop() in jquery. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to use PUT request method in jQuery?

Detailed explanation and usage introduction of MySQL ISNULL function

How to remove the height attribute of an element with jQuery?

jQuery Tips: Quickly modify the text of all a tags on the page

Use jQuery to modify the text content of all a tags

Understand the role and application scenarios of eq in jQuery
