Multiple animation pause issues (use of the Stop () method)

Source: Internet
Author: User
Tags diff

The final result of today's simulation of a site's navigation bar effect

To do this effect encountered the point:

1. Give each a binding event too cumbersome, using the event delegate, because just look at JQ so found

$ ('. List '). Delegate (' A ', ' mouseover ', function (event) {}

Method

2. Set the jitter effect for this small slider, more dynamic some use two animate to calculate the final position with three animate

. Animate ({left:ao+diff+ ' px '},150). Animate ({left:ao-diff/2+ ' px '},150). Animate ({left:m+ ' px '},200);

Yes, dug a hole.

3. is to solve this pit, this pit is when I mouse quickly through these a, even if I stop the mouse, the slider still press my mouse through each A in doing a mouseover event, like convulsions, how to solve it?

Immediately think of the Stop () method stop animation, but useless ah also with convulsions, because just contact JQ so not familiar with these methods, think is not stop () method can also pass parameters? Sure enough, I guess right.

Definition and usage

The Stop () method stops the animation that is currently running.

Grammar
$ (selector). Stop (stopall,gotoend)
Parameters Description
StopAll Optional. Specifies whether to stop all queue-join animations for the selected element.
Gotoend

Optional. Specifies whether to allow the current animation to be completed.

This parameter can only be used when the StopAll parameter is set.

Stop () when there are no arguments: Just pause the previous animation Oh, like there are multiple animations 1 2 3

If this pauses then if the animation moves to 2, the pause is just 2, and 3 will continue to run.

Stop (TRUE) a parameter: that is, the StopAll said above is

If this pauses then if the animation moves to 2, the pause pauses 2 and 3 (all pauses)

Stop (true,true) two parameters:

If this pauses then then if the animation moves to 1, the pause will immediately let the animated elements reach the state of the 1 animation settings (the state at the time the animation 1 is completed) and pause, and if the animation moves to 2, the pause will immediately let the animated element reach the state of the 2 animation setting (the state at the time the animation 2 finishes) and pause, likewise 345 6

Demo:http://www.w3school.com.cn/tiy/t.asp?f=jquery_effect_stop_queue_end

Where there are errors, welcome to the point.

Multiple animation pause issues (use of the Stop () method)

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.