Among several effects, there also exists animation in jquery. Yes, we can also animate a jquery element such as a div or button using the animate() method.
Syntax
$(selector).animate({params},speed,callback);
Params is the required parameter and it defines the CSS properties to be animated. properties may include left,right, opacity and many others
Speed and callback are optional parameter. Speed specifies the duration of the effect and can take values: “slow”, “fast”, or milliseconds. Callback parameter is a function to be executed after the animation completes.
$("button").click(function(){
$("div").animate({
left: '200px',
opacity: '0.7',
height: '120px',
width: '120px'
});
});
Leave a comment