当鼠标悬停在元素上时,我想要正确的方式来删除背景
我试过这些:
$("#store_header .right #nav ul li").hover(function() {
$(this).animate({backgroundColor : '#0097d5'}, 200);}
,function() {
$(this).animate({backgroundColor : ''}, 200);
}
);
但是第二个函数不起作用,所以请告诉我错误是什么,正确的是什么
您需要设置要还原的颜色,请检查工作演示。(注:包含jquery ui)
$("#store_header .right #nav ul li").hover(function() {
$(this).animate({backgroundColor : '#0097d5'}, 200);
} ,function() {
$(this).animate({backgroundColor : '#fff'}, 200);
}
);
演示
$("#store_header .right #nav ul li").hover(
function() {
$(this).animate({backgroundColor : '#0097d5'}, 200);
}, function() {
$(this).animate({backgroundColor : 'transparent'}, 200);
}
);