Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use queue function in animate () in jQuery

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use the queue function of animate () in jQuery. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

JQuery animate ()-use the queue feature

By default, jQuery provides queuing for animation.

This means that if you write multiple animate () calls after each other, jQuery creates an "internal" queue that contains those method calls. Then run these animate calls one by one.

Example 1

Hide, if you want to perform different animations after each other, then we will take advantage of the queuing feature:

Click (function () {var div=$ ("div"); div.animate ({height:'300px',opacity:'0.4'}, "slow"); div.animate ({width:'300px',opacity:'0.8'}, "slow"); div.animate ({height:'100px',opacity:'0.4'}, "slow"); div.animate ({width:'100px',opacity:'0.8'}, "slow");})

Example 2

The following example moves the element to the right and then increases the font size of the text:

$("button") .click (function () {var div=$ ("div"); div.animate ({left:'100px'}, "slow"); div.animate ({fontSize:'3em'}, "slow");}) This is the end of the article on "how to use the queue function of animate () in jQuery". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report