jQuery Animation

The .animate() method allows us to create animation effects on any numeric CSS property. This method changes an element from one state to another with CSS styles. The CSS property value is changed gradually, to create an animated effect.

Syntax is:

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

  • styles: Specifies one or more CSS properties/values toanimate.
  • duration: Optional. Specifies the speed of the animation.
  • easing: Optional. Specifies the speed of the element in different points of the animation. Default value is “swing”.
  • callback: Optional. A function to be executed after the animation completes.

Simple use of animate function is,

Hide Copy Code
$(“btnClick”).click(function(){
$(“#dvBox”).animate({height:”100px”});
});

Share

Leave a Reply

Your email address will not be published. Required fields are marked *