Monday 13 February 2012

jQuery: How to animate opacity (from hidden to visible)

Assuming we want to animate all the divs...and that the initial opacity of the divs is 0 (not visible):
var $elem = $('.div');
$elem.animate({'opacity':1},800,function(){
 //      
});

References

Method signature:
.animate( properties [, duration] [, easing] [, complete] )

where

* properties: A map of CSS properties that the animation will move toward.
* duration: A string or number determining how long the animation will run.
* easing: A string indicating which easing function to use for the transition.
* complete: A function to call once the animation is complete.

No comments:

Post a Comment