【发布时间】:2013-08-16 18:41:06
【问题描述】:
我的代码有一点问题。我有一堆具有不同背景颜色的类元素,名为“jq”。我在悬停时为背景颜色设置动画,然后将其恢复为原始颜色:这是 .css('backgroundColor') 应该获取任何悬停且带有 jq 类的给定 div 的颜色的地方。 相反,我将 div 背景恢复为白色。这是我的代码:
$(document).ready(function(){
$(".jq").hover(
var bgcol = $(this).css('backgroundColor');
function(){
$(this).animate({
backgroundColor: "#EAEAEA",
color:"#333"
},trans);
},
function() {
$(this).animate({
backgroundColor:'bgcol',
color:"#888"
},trans);
});
});
【问题讨论】:
-
你试过了吗:背景颜色你的文字有点乱
标签: jquery css background get