The animation of jquery learning

Source: Internet
Author: User

One, show () and Hide ()

The show () and Hide () methods are equivalent to CSS ("display", "None/block/inline") in the case of no parameters,

The effect is to hide or display the matching elements immediately, without any animations.

If you need to drive the drawing, you can add the parameter to the show () method

exp:$ (' #id '). Show ("slow");

$ (' #id '). Show (1000);//1000 MS, equivalent to 1 seconds

II, FadeIn () and fadeout ()

These two methods only change the transparency of the element, and FadeOut () decreases the opacity of the element for a specified period of time until

The element disappears completely ("Display:none"); FadeIn () is just the opposite.

Three, Slideup () and Slidedown ()

These two methods will only change the height of the element

Four, custom animate animate ()

You can customize the animation while changing the height, width, and opacity of the element.

Animate (Params,speed,callback)

Params: A containing style and worth mapping {property1: "value1", Property: "Value2"}

Speed: Velocity parameters, optional

Callback: function when the animation finishes executing, optional

$ (function () {

$ ("#panel"). Click (function () {

$ (this). Animate ({left: "+=500px"},300); Accumulate 500px at current position

});

})

Five, animation callback function

Change the style of an element when the last step of the animation

$ (function () {

$ ("#panel"). Click (function () {

$ (this). Animate ({left: "+=500px", Opacity: "1"},300);

. Animate ({top: "200px", Width: "200px"},3000,function () {

$ (this). CSS ("Border", "5px solid Blue");

});

})

Six, stop the animation and judge whether it is in an animated state

1, stop animation of elements

Stop ([Clearqueue],[gotoend])

Clearqueue whether to empty the non-executed animation queue

Gotoend whether the animation being executed will jump to the end state directly

2, determines whether the element is in an animated state

if (!$ (Element). Is (": Animated")) {

If no animation is currently in progress, add a new element

}

3, delayed animation delay ()

Seven, other animation methods

Toggle ()

Toggle Visible State

Slidetoggle ()

Toggle the visibility of elements with height changes

FadeTo ()

You can adjust the opacity of an element to a specified value in a progressive way

Fadetoggle

Toggle the visibility of an element by means of transparency

The animation of jquery learning

Related Article

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.