【发布时间】:2013-03-23 21:26:20
【问题描述】:
如何启用或禁用(或切换)'after' 伪类?
我试图想出一些类似的东西:
$('.card').click(function(){
if(pick1) {
pick2 = $(this).css('background-color');
id2 = $(this).attr('id');
>>> add display:none to .card:after for the clicked div <<<
if(pick1 == pick2 && id1!=id2) alert('Correct');
else {
alert('Incorrect');
>>> remove display:none from .card:after on clicked divs <<<
}
pick1 = false;
pick2 = false;
} else {
pick1 = $(this).css('background-color');
id1 = $(this).attr('id');
>>> add display:none to .card:after for the clicked div <<<
}
});
【问题讨论】:
-
您能解决您的问题吗?
-
是的,谢谢 :) 我创建了一个单独的课程并在需要的地方添加/删除了它。
-
太棒了。如果我的回答对您有帮助,请随时接受,以便其他人知道问题已得到解决。
标签: javascript jquery css class html