Home > front end >  JQuery animations
JQuery animations

Time:12-27

JQuery basic results show () and hide ()
Show ([speed], [much], [fn])
show hidden matched elementHide ([speed], [much], [fn]) hidden display element
Toggle ([speed], [much], [fn])
To bind two or more of the event handler function, in response to the selected elements take turns to the click event,
If the element is visible, switch to a hidden; If the element is hidden, and switch to a visible,
Parameter description:
The speed of speed: show/hide effect, default is "0" milliseconds, the possible values: missile (600), normal, fast (200), "
Much: (Optional) is used to specify switching effects, the default is "swing", "linear" available parameter
Fn: in the function to be executed by the animation is completed, each element performs a
Description: through the display style property value control elements to hide and display
The parameters of the three methods that can refer to the jQuery API
$(ele). The show () method will be the width of the matched elements, height, and opacity, and at the same time for animation operation
The effectiveness of sliding in the jQuery
SlideDown ([speed], [much], [fn])
Down through the height change (increase) to dynamically display all of the matched elements, optionally trigger at the completion of a display a callback function
This animation effects only the height of the elements, can make the matching element is displayed in the form of "sliding"
SlideUp ([speed], [much], [fn])
Through highly changes (reduce) up to dynamically to hide all of the matched elements, optionally trigger at the completion of a hidden a callback function
This animation effects only the height of the elements, can make the matching element is displayed in the form of "sliding"
SlideToggle ([speed], [much], [fn])
Through the height changes to switch the visibility of all matched elements, and optionally trigger at the completion of a switch a callback function
Parameter description:
The speed of speed: show/hide effect, default is "0" milliseconds, the possible values: missile, normal, fast, "
Much: (Optional) is used to specify switching effects, the default is "swing", "linear" available parameter
Fn: in the function to be executed by the animation is completed, each element performs a
The fading effect of jQuery
FadeOut ([speed], [much], [fn])
By the change of the opacity of all matched elements fade out effect, after completion of the animation and optionally trigger a callback function,
This animation only adjust the opacity element, that is to say, all of the matched elements of height and width will not change
FadeIn ([speed], [much], [fn])
By the change of the opacity of all matched elements fade-in effect, after completion of the animation and optionally trigger a callback function,
This animation only adjust the opacity element, that is to say, all of the matched elements of height and width will not change,
FadeToggle ([speed], [much], [fn]) : through changing the opacity of all matched elements to switch fade in and
Fade out effect, after completion of the animation and optionally trigger a callback function,
This animation only adjust the opacity element, that is to say, all of the matched elements of height and width will not change
Parameter description:
The speed of speed: show/hide effect, default is "0" milliseconds, the possible values: missile, normal, fast, "
Much: (Optional) is used to specify switching effects, the default is "swing", "linear" available parameter
Fn: in the function to be executed by the animation is completed, each element performs a
Opacity: transparency
FadeTo (speed, opacity, [much], [fn])//0 ~ 1: put the opacity of all matched elements adjusted by gradual
To a specified opacity and after completion of the animation optionally trigger a callback function,
This animation only adjust the opacity element, that is to say, all of the matched elements of height and width will not change,
The custom jQuery Animation Animation
In front of a few methods, are defined in the jQuery simple animation effects, if you want to realize more complex animation,
You need to use animation animation to achieve
The animate (params [speed], [much], [fn]) is used to create a custom animation function,
This function is the key to specify the animation form style attributes object, and the results of each attribute in this object indicates a
Can change the style properties (such as "height", "top" or "opacity"), note: all the specified attribute must be
In the form of a camel, such as substitute marginLeft margin - left.
And the value of each attribute says this animation with the style attribute to the end, if it is a numerical value, style properties from
The current value of the gradient to the specified value, if you are using "hide", "show" or "toggle" such a string value,
Will invoke the default for the attribute of the form of animation,
Parameter description:
Params: one group contains as animation and the style of the final value attribute and its value, the collection of {} : attribute value, attribute: attribute value
Speed: string, one of the three scheduled speed (" missile ", "normal", or "fast") or said animation long millisecond value (such as: 1000)
Much: to use the erase the effect of (need to plug-in support). The name of the default jQuery "linear" and "swing".
Fn: in the function to be executed by the animation is completed, each element execution time,
Parameters of special
Param parameter of special note: pay special attention to all the animation attributes must be digital, unless otherwise specified.
These attributes if not Numbers will not be able to use basic jQuery function, such as common and borderWidth, margin, padding,
Width, height, fontSize, left, top, right, bottom, wordSpacing etc. These are all can produce animation
Background - color obviously can't, because the value of the parameter is red or GBG under normal circumstances, unless with plug-in is
Not only the animation effects,
Note that writing CSS styles to use DOM attributes (such as "fontSize") to set up, if you want to use "the font - size
"You need to add double quotation marks,
Special note: unit, the attribute value of unit pixels (px), unless otherwise specified, em and % need to specify the use,
  • Related