ECMAScript
ECMAScript

Reputation: 4649

Make fadetoggle fade in

How would I make it so jQuery fades in when an element is visible?

Here is my code example: http://jsfiddle.net/IntelandBacon/nWscz/

$('.expand').click(function () {
    $(this).next().css("visibility", "visible");
    $(this).next().fadeToggle("slow");
});

Thanks.

Upvotes: 0

Views: 514

Answers (1)

Banning
Banning

Reputation: 2287

http://jsfiddle.net/nyWzK/

Change your JS to look like this

$('.expand').click(function () {
    $(this).next().fadeToggle("slow");
});

THEN Change <tr style="visibility: hidden;"> in your css to <tr style="display:none;">

if you want to stick with the whole visibility thing then you'll have to explore jquery's animate function combined with css opacity - HOWEVER, I would recommend against this as its extra effort you don't really need.

Upvotes: 2

Related Questions