Solve the problem of animating animate by clicking multiple jquery animations
Source: Internet
Author: User
Recently made a Web page, using animate animation effect, click on the connection to scroll the screen to the appropriate location, but the previous few clicks no problem, as the number of clicks increased, the animation response is more and more slow, and then click once to wait a few seconds to start scrolling, finally I found the reason, the animation does not play the end, The queue is getting longer. Workaround: $ (' body '). Stop (). Animate ({scrolltop:aaa},300); add a stop before animate to stop the current animation empty queue and execute the new animation immediately. Attach stop (); use: Stop ([Clearqueue], [gotoend]) Overview Stop all animations that are running on the specified element. If there are animations waiting to be executed in the queue (and Clearqueue is not set to true), they will be executed immediately. Parameter Clearqueue (optional) Boolean if set to True, clears the queue. You can end the animation immediately. Gotoend (optional) Boolean lets the currently executing animation complete immediately, and resets the original style of show and hide to call the callback function, and so on.
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.