有人可以帮助我这个jquery停止鼠标事件后单击事件
我想从单击事件设置元素的不同颜色。
问题是,mouseover事件使一切再次变白。所以,我绝不会从 中看到活跃(actief)课程的颜色。
我能做些什么,我已经尝试把stopevent传播()?
感谢,理查德
$("#tbestel_opties2 span").live("mouseover", function() {
$t=$(this);
if(!$t.hasClass('actief')){
$t.css({'color':'#fff','backgroundColor':'#fdc601'});
}
});
$("#tbestel_opties2 span").live("mouseout", function() {
$t=$(this);
if(!$t.hasClass('actief')){
$t.css({'color':'#333','backgroundColor':'#fdc601'}); }
});
$("#tbestel_opties input,#tbestel_opties2 span").live("click", function(e)
{e.stopPropagation();
$t=$(this);
$('#tbestel_opties2 .actief').removeClass("actief").css({'color':'#333'});
$t.addClass("actief")
$("#opties li:eq(0)").addClass("actief");
});
谢谢,所以只使用addClass而不是css()。我会尝试。虽然我不明白为什么HasClass没有工作? – Richard 2009-12-16 01:47:14