Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fadeIn vs fadeOut vs fadeTo

What is the difference between fadeIn vs fadeOut vs fadeTo ?

like image 657
Pranay Rana Avatar asked Jul 22 '10 17:07

Pranay Rana


1 Answers

fadeIn fades from an elements current opacity to 1.
fadeOut fades from an elements current opacity to 0.
fadeTo fades from an elements current opacity to a given opacity.

$('#myObject').fadeTo('fast', 0.5, function() {
    $('#myObject').fadeTo('fast', 0.8);
});

The above fades myObject from whatever opacity it has, to 0.5, which is 50% transparency, and after that, it fades up again to 20% transparency.

like image 82
David Hedlund Avatar answered Sep 24 '22 02:09

David Hedlund