animate() method in jQuery
animate()
The animate() method allows a selected element to animate from a set of values to a new set of values. It has two parameters. These are:-
The first parameter defines the CSS properties which needed to be changed for animation purposes. All properties should be written in camelCase. The properties are written in JSON Format like ("key": "value" pairs).
The second parameter is the speed of the animation.
Syntax:-
Its syntax is:- (selector).animate({styles}, speed, easing, callback);
Further Explanation:-
Parameter | Description |
---|---|
styles | Required. Specifies one or more CSS properties/values to animate. THe property name must be written in came-cased. |
speed | Optional. Specifies the speed of the animation. Default value is 400 milliseconds |
easing | Optional. Specifies the speed of the element in different points of the animation. Default is swing. |
callback | Optional. A function to be executed after the animation completes. |