Introduction to slide and Animation Based on JQuery

Source: Internet
Author: User
Document directory
  • JQuery stop () method

JQuery sliding method:You can create a slide effect on the element.
SlideDown () slide down the element.
SlideUp () slides up the element.
SlideToggle () switches between the slideDown () and slideUp () methods.

$ (Selector). slide (speed, callback );
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or millisecond.
The optional callback parameter is the name of the function executed after sliding.

JQuery Animation-The jQuery animate () method is used to create custom animations.
Syntax:
$ (Selector). animate ({params}, speed, callback );
The required params parameter defines the CSS attributes of the animation.
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or millisecond.
The optional callback parameter is the name of the function executed after the animation is completed.
By default, all HTML elements are static and cannot be moved. To operate the position, first set the position attribute of the element CSS to relative, fixed, or absolute.
JQuery animate ()-Ability to operate on multiple attributes
To generate a Color animation, You need to download the Color animation plug-in from jQuery.com.
JQuery animate ()-Use Relative Value
You can also define a relative value (this value is relative to the current value of the element ). + = Or-= must be added before the value:

JQuery animate ()-Use predefined values
You can even set the animation value of an attribute to "show", "hide", or "toggle ":
$ ("Button"). click (function (){
$ ("Div"). animate ({
Height: 'toggle'
});
});

JQuery animate ()-Use the queue Function
By default, jQuery provides the queue function for animation.
This means that if multiple animate () calls are written after each other, jQuery will create an "internal" queue containing these method calls. Then run these animate calls one by one.

Ex1, ex2

JQuery stop () method

The jQuery stop () method is used to stop an animation or effect before they are completed.

The stop () method applies to all jQuery effect functions, including sliding, fade-in and fade-out, and custom animations.

$(selector).stop(stopAll,goToEnd);

The optional stopAll parameter specifies whether to clear the animation queue. The default value is false, that is, only the animation that stops the activity allows any animations that are placed in the queue to be executed backward.

The optional goToEnd parameter specifies whether the current animation is completed immediately. The default value is false.

Therefore, by default, stop () clears the current animation specified on the selected element.

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.