如何启用或禁用(或切换)“之后”伪类?
我试图想出一些类似的东西:
$('.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 <<<
}
});
我的项目在这里:http: //jsfiddle.net/94jerdaw/29TCZ/3/