jQuery .animate() Method
|properties||An object of CSS properties and values that the animation will move toward|
|duration||(default: 400) A string or number determining how long the animation will run|
|easing||(default: swing) A string indicating which easing function to use for the transition|
|complete||A function to call once the animation is complete, called once per matched element.|
|start||specifies a function to be executed when the animation begins.|
|step||specifies a function to be executed for each step in the animation.|
|queue||a Boolean value specifying whether or not to place the animation in the effects queue.|
|progress||specifies a function to be executed after each step in the animation.|
|done||specifies a function to be executed when the animation ends.|
|fail||specifies a function to be executed if the animation fails to complete.|
|specialEasing||a map of one or more CSS properties from the styles parameter, and their corresponding easing functions.|
|always||specifies a function to be executed if the animation stops without completing.|
Animation with callback
Sometimes we need to change words position from one place to another or reduce size of the words and change the color of words automatically to improve the attraction of our website or web apps. JQuery helps a lot with this concept using
fadeIn(), hide(), slideDown() but its functionality are limited and it only done the specific task which assign to it.
Jquery fix this problem by providing an amazing and flexible method called
.animate(). This method allows to set custom animations which is used css properties that give permission to fly over borders. for example if we give css style property as
width:200; and current position of the DOM element is 50, animate method reduce current position value from given css value and animate that element to 150.But we don't need to bother about this part because animation engine will handle it.
List of css style properties that allow in
Speed specified in
Easing specified in
Here is some examples with complex animation options.