问题描述
我试图使用JQuery来淡化span标签的背景颜色,以强调发生更改时的情况。我正在考虑代码将在click处理程序中像下面的内容,但我似乎无法得到它的工作。你能告诉我我出错的地方吗?
感谢Russ。
$ $ $ $ $ $ $ $span。fadeOut(slow).css(background-色 )VAL( FFFF99\" );
好了,但现在它会淡化背景span标签的颜色和span标签的文本值。我试图淡化背景颜色并让文字可见。可以这样做吗?
哦,我没有意识到你想淡化颜色!好的,所以你需要查看jQuery颜色插件:
以下是jQuery文档网站另一个有用的部分:
I我从来没有真正做到这一点,所以我不会尝试给你代码,但我想象色彩插件会给你你需要的功能。
I'm trying to fade the background-color of a span tag using JQuery to emphasize when a change has occured. I was thinking the code would be someting like the following inside the click handler, but I can't seem to get it working. Can you show me where I went wrong?Thanks Russ.
$("span").fadeOut("slow").css("background-color").val("FFFF99");
That's better, but now it fades both the background-color of the span tag and the text value of the span tag too. I'm trying to just fade the background-color and leave the text visible. Can that be done?
OH, I didn't realize you wanted to fade the color! OK, so you need to check out the jQuery color plugin:
https://github.com/jquery/jquery-color/
And here's another helpful section of the jQuery docs site:
http://docs.jquery.com/Release:jQuery_1.2/Effects#Color_Animations
I've never actually done this so I won't try to give you code, but I imagine the color plugin will give you the functionality you need.
这篇关于用JQuery淡入span标签的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!