Ever wanted to move things around on your webpage? Make them grow, shrink, or slide diagonally? With jQuery’s animate() function, you can create custom animations that look fun and interactive.
What is animate()?
animate() lets you change the CSS properties of an element over time. For example, you can:
Move an element to the right
Resize it
Change its opacity
Or do all of those at once—smoothly!
Basic Syntax
$(selector).animate({ properties }, speed);
selector – the element you want to animate
properties – the CSS properties you want to change
speed – how fast the animation happens (like "slow", "fast", or in milliseconds)
Example: Move a Box to the Right
When you click the button, the box slides 250px to the right!
Note: You must set position: relative or absolute on the element to move it.