Jquery animation effect instructions, jqueryanimate

Source: Internet
Author: User

Jquery animation effect instructions, jqueryanimate
Animate (params, [duration], [easing], [callback])
A function used to create a custom animation.
The key to this function is to specify the animation form and result style attribute object. Each attribute in this object represents a changeable style attribute (such as "height", "top", or "opacity "). Note: All specified attributes must be in the camel format. For example, margin-left must be replaced by marginLeft.
The value of each attribute indicates the animation ends when the style attribute is reached. If it is a value, the style property will gradually change from the current value to the specified value. If a string value such as "hide", "show", or "toggle" is used, the default animation format is called for this attribute.
In jQuery 1.2, you can use em and % units. In addition, in jQuery 1.2, you can specify "+ =" or "-=" before the attribute value to make the element do relative motion.
In jQuery 1.3, if the duration is set to 0, the animation is directly completed. In earlier versions, the default animation is executed.
After clicking the button, several different attributes of the div element change together:
The Code is as follows:
// Apply three types of effects to a jquery animation at the same time
$ ("# Go"). click (function (){
$ ("# Block"). animate ({
Width: "90% ",
Height: "100% ",
FontSize: "10em ",
BorderWidth: 10
},1000 );
});
Animate (params, options)
A function used to create a custom animation.
The key to this function is to specify the animation form and result style attribute object. Each attribute in this object represents a changeable style attribute (such as "height", "top", or "opacity "). Note: All specified attributes must be in the camel format. For example, margin-left must be replaced by marginLeft.
The value of each attribute indicates the animation ends when the style attribute is reached. If it is a value, the style property will gradually change from the current value to the specified value. If a string value such as "hide", "show", or "toggle" is used, the default animation format is called for this attribute.
In jQuery 1.2, you can use em and % units. In addition, in jQuery 1.2, you can specify "+ =" or "-=" before the attribute value to make the element do relative motion.
After the first button is pressed, the animation that is not in the queue is displayed. When the div is expanded to 90%, the font is also added. Once the font is changed, the animation of the border begins:
The Code is as follows:
$ ("# Go1 "). click (function () {$ ("# block1 "). animate ({width: "90%" },{ queue: false, duration: 5000 }). animate ({fontSize: '10em '}, 1000 ). animate ({borderWidth: 5}, 1000) ;}); $ ("# go2 "). click (function () {$ ("# block2 "). animate ({width: "90%"}, 1000 ). animate ({fontSize: '10em '}, 1000 ). animate ({borderWidth: 5}, 1000 );});
Stop ([clearQueue], [gotoEnd])
Stops all animations that are running on the specified element.
If there are animations waiting for execution in the queue (and clearQueue is not set to true), they will be executed immediately
ClearQueue (Boolean): If it is set to true, the queue is cleared. The animation can be ended immediately.
GotoEnd (Boolean): enables immediate completion of the animation being executed, resetting the original style of show and hide, and calling the callback function.
Click Go to start the animation. After you click Stop, the animation stops at the current position:
The Code is as follows:
// Start the animation $ ("# go "). click (function () {$ (". block "). animate ({left: '+ 200px'}, 5000) ;}); // click the button to stop the animation $ ("# stop "). click (function () {$ (". block "). stop ();});

 

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.