我尝试编辑 css 选择器的值:after,但它在 jQuery 中不起作用
$('.triangle-right.left:after').css("border-color","transparent #fff");
该怎么办?
CSS:
.triangle-right.left:after {
top:4px;
left:-10px; /* value = - border-left-width - border-right-width */
bottom:auto;
border-width:15px 15px 0 0; /* vary these values to change the angle of the vertex */
border-color:transparent #bdd5bb;
}
我想在 javascript 中更改边框颜色。HTML:
document.getElementById('canvas').innerHTML += "<div id='talkbubble-" + u + "' style='display:none;color:#000;position:absolute;left:" + (left +9) + "px;top:" + (top + 1) + "px;z-index:" + (z + 95) + "'>" +
"<p class='triangle-right left' id='text_"+u+"' style=\"color:#0d0e0c;background:#bdd5bb;\"></p>" +
"</DIV>";
Javascript/jQuery:
$('#text_'+u).css("color","#000");
$('.triangle-right.left').next().css("border-color","transparent #fff");
$('#text_'+u).css("color","#0d0e0c");
$('#text_'+u).css("background","#fff");
$('#text_' + u).html(sockb.data.text);
$('#talkbubble-' + u).fadeIn();
tDelays[u] = setTimeout(function () {
$('#talkbubble-' + u).fadeOut(function () {
$('#text_' + u).html("");
delete tDelays[u];
});
}, 15000);