Get the App
SLTechnology News&Howtos  ›  Development  › 

The CSS property set in jQuery animate ()

Shulou Source: shulou.com Published: 2022-06-03 19:02:04 09月23日 Update

This article introduces the relevant knowledge of "CSS attribute set in jQuery animate ()". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The animate () method performs a custom animation of the CSS property set.

This method changes an element from one state to another through the CSS style. The value of the CSS property changes gradually so that you can create an animation effect.

Only numeric values can create animations (such as "margin:30px"). String values cannot create animations (such as "background-color:red").

Tip: use "+ =" or "- =" to create relative animation.

Syntax:

(selector) .animate ({styles}, speed,easing,callback)

The required description styles for the parameter is

Specifies one or more CSS attributes / values that produce animated effects.

Note: when used with the animate () method, the property name must be written as a hump: you must use paddingLeft instead of padding-left,marginRight instead of margin-right, and so on.

You can apply the attributes of the animation:

BackgroundPositionX

BackgroundPositionY

BorderWidth

BorderBottomWidth

BorderLeftWidth

BorderRightWidth

BorderTopWidth

BorderSpacing

Margin

MarginBottom

MarginLeft

MarginRight

MarginTop

OutlineWidth

Padding

PaddingBottom

PaddingLeft

PaddingRight

PaddingTop

Height

Width

MaxHeight

MaxWidth

MinHeight

MinWidth

FontSize

Bottom

Left

Right

Top

LetterSpacing

WordSpacing

LineHeight

TextIndent

Tip: color animation is not included in the core jQuery library. If you want to apply animated colors, you need to download the color animation plug-in from jQuery.com.

Speed No

Specifies the speed of the animation.

Possible values:

Millisecond

"slow"

"fast"

Easing No

Specifies the speed of elements at different points in the animation. The default is "swing".

Possible values:

"swing"-move slowly at the beginning / end and fast in the middle

"linear"-moving at a uniform speed

Tip: more easing functions are available in the extension.

Callback No

The function to be executed after the animate function has been executed.

To learn more about callback, please visit our jQuery Callback chapter.

Jq tutorial / / this version is Baidu cdn 1.11.1. Of course, you can use a higher version. Ie6-8 is not supported from version 2.0 or above.

Tags: Animation attributes elements more movement content function method version color hint situation plug-in effect state knowledge speed learning application related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi Linux Shulou Technology MySQL