views:

59

answers:

3

What is the difference between fadeIn vs fadeOut vs fadeTo ?

+1  A: 

FadeIn.. Shows an element gradually

FadeOut .. Hides an element gradually

FadeTo .. Changes the opacity of an element to a given value

dejavu
+1  A: 

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.

David Hedlund
A: 

I see only linguistic redundance here, since fadeTo fits all the use cases regardless.

Davi Lima