Usage and difference between jq stop () and is (: animated) (detailed description), jqanimated

Source: Internet
Author: User

Usage and difference between jq stop () and is (: animated) (detailed description), jqanimated

Stop (true, true ):

It indicates that the animation of the matching element is stopped, the animation is redirected to the final state, and the animation queue is cleared. It is often used to solve the problem that the animation effect is inconsistent with the cursor action because the cursor moves too quickly!

JQuery stop () method

The jQuery stop () method is used to stop an animation or effect before they are completed.

The stop () method applies to all jQuery effect functions, including sliding, fade-in and fade-out, and custom animations.

Syntax

$ (Selector). stop (stopAll, goToEnd); The Optional stopAll parameter specifies whether to clear the animation queue. The default value is false, that is, only the animation that stops the activity allows any animations that are placed in the queue to be executed backward.

The optional goToEnd parameter specifies whether the current animation is completed immediately. The default value is false.

Therefore, by default, stop () clears the current animation specified on the selected element.

The following example demonstrates the stop () method without parameters:

$("#stop").click(function(){  $("#panel").stop(); });   

: Is (": animated"): The animated is the jQ selector that selects all animation elements.

It is used to determine whether an element is animated. It is often used to "continuously click the top or bottom button and only respond to the user's first click action.

if(!$("#lunbolist li").is(":animated")){       $("#lunbolist li").filter(".on").hide();       $("#lunbolist li").eq(currentindex).fadeIn(100).addClass("on").siblings().removeClass("on");       $(this).addClass("on").siblings().removeClass("on");     } 

The usage and difference between the above jq stop () and is (: animated) are all the content shared by the editor. I hope you can give me a reference, we also hope that you can support the customer's home.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.