$('item').animate({marginLeft:"800px"},500);  
  //where 500 is the time in ms for the effect to occur in
  

That's great, but what if you wanted to control how that item got animated towards the end-point in a more generic way.That's where jQuery's Effect functions come into play. By default, jQuery provides us with functions like slideUp and slideDown, fadeIn and fadeOut as well as hide() and show(). You can click on these to see the official documentation on the function, but in short they let you slide items from one position to another, fade in and out or hide or be displayed within a specific amount of time. They're very useful and can be incredibly powerful.

Basic Effects

Fade out and Fade in

 

SlideUp and SlideDown
This text will be slid up and then slid back down. This is achived using chaining
but don't worry..you can use each effect on its down
This text will be slid up and then slid back down. This is achived using chaining
but don't worry..you can use each effect on its down


Hide and Show (chained version)
This text and the div above will be hidden
This text and the div above will be hidden


Toggle to hide in a direction using opacity effects


Intermediate


Increasing/decreasing the width of an item each time it's clicked

 

This code expands the width from 400px to 500px
and when done, it expands the height from 20px to 150px

News Headline: You can read more news just by clicking here
As you can see we've just revealed some more information that's visible in the original div but not in the css view we've created

  
News Headline: This div is about to do something cool.
As you can see we've just revealed some more information that's visible in the original div but not in the css view we've created

Moving an item across the page

News Headline: This div is about to do something cool.
As you can see we've just revealed some more information that's visible in the original div but not in the css view we've created

Moving an item across the page

Make an item animate to the full width of the window



Animating the background-position

 

Advanced

Animating the widths of 3 divs using an interval to update their values over 10 seconds






  







An Animated Accordian in 9 lines of code (no plugins required)
Section 1
Section 2
Section 3
Section 1
Section 2
Section 3


A progess bar in 3 lines - click to see in action


Graph Effect - Increase the heights of multiple divs



  
  



Growing and animating width, opacity and font size
A News Headline

A News Headline

Creating a nice Opacity effect for images on hover using fadeTo

jQuery is awesome
jQuery is awesome
 


Creating a game animation using chaining
Avatar Gauth

Avatar Gauth

If you would like to download the CSS for all of these samples, click here