如何将右边框颜色更改为class:after
这个css是正常的
.profile-options a div:after {
border-color: transparent #999999 transparent transparent;
border-style: solid;
border-width: 18px;
content: "";
display: block;
left: -15px;
margin-top: -33px;
position: absolute;
z-index: 999;}
我需要在 jquery 选择时将 #999999 设置为 #333333
我试过了,但是好像不行
$(".profile-options a div:after").css({"borderRightColor":"#999"});
$(".yourOptions1:after").css({"borderRightColor":"#333"});
最佳答案
您可以使用 styleSheets
。
假设您有一个样式表,该规则是第一条规则,那么您需要做的就是:
document.styleSheets[0].cssRules[0].style.borderRightColor="#333333";
All you need to know about StyleSheets, Add, Remove, Alter, both IE and other Browsers
使用 styleSheets 还可以添加有关伪元素的 css 规则。
关于jquery - 更改 div :after border right color by jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15087736/