开发者

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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜