How jquery stops animate animation for an element, and how to tell if it is in an animated state

Source: Internet
Author: User

jquery's animation will automatically enter the queue, there is a problem, these animations will be executed one by one, and our actual intention is that when the mouse moves away when the animation is terminated.

animation method for stopping elements:stop ()
syntax structure:stop ([Clearqueue],[gotoend])
Both Clearqueue and gotoend are optional parameters, which are Boolean values.
Clearqueue: Do you want to empty the list of animations that are not playing
Gotoend: Whether to jump directly to the end state of the animation being performed

The Stop () method is often used in animation of hover time to avoid the delay animation caused by inconsistent animation effects with the cursor action.
For example:

1234567 $(".test").hover(function(){    $(this).stop().animate({height:"150",width:"300"},200);},function(){    $(this).stop().animate({height:"50",width:"100"},3200);});

Determines whether an element is animated:

123 if(! $(elememt).is(":animated") ){ //判断元素是否处于动画状态 //如果当前没有进行动画,则添加}

How jquery stops animate animation for an element, and how to tell if it is in an animated state

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.