Main introduction: JavaScript reinforcement tutorial-jQuery animation-animate () method jQueryanimate () method is used to create a custom animation. JQuery animation-animate () method
The jQuery animate () method is used to create custom animations.
Syntax:
$(selector).animate({params},speed,callback);
The required params parameter defines the CSS attributes of the animation.
The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or millisecond.
The optional callback parameter is the name of the function executed after the animation is completed.
The following example demonstrates the simple application of the animate () method.
Move the element to the left until the left attribute is equal to 250 pixels:
Instance
$("button").click(function(){ $("p").animate({left:'250px'}); });