rem
rem

Reputation: 17045

jQuery applying CSS style with an effect like FadeIn() one

In a jQuery script I'm applying a CSS style to a html table row to highlight it on a row link click:

$(this).closest('tr').css("background-color", "silver");

How can this changing color effect be appied softly with an effect like fading in a hidden object?

Upvotes: 1

Views: 199

Answers (2)

DaiYoukai
DaiYoukai

Reputation: 1898

Please note: You need to use JQuery UI as well.

$(this).closest('tr').animate({ backgroundColor: "silver" }, 1000);

Replace 1000 with how long you want it to take to change to silver.

Upvotes: 1

JasCav
JasCav

Reputation: 34632

Color can be animated using jQuery. The easiest way to accomplish this is to use the Color Plugin. Also, if you are already using jQuery UI, it also supports this functionality.

Upvotes: 3

Related Questions