相关疑难解决方法(0)

使用jQuery选择和操作CSS伪元素,例如:: before和:: after

有没有办法使用jQuery 选择/操作CSS伪元素,如::before::after(以及带有一个分号的旧版本)?

例如,我的样式表具有以下规则:

.span::after{ content:'foo' }
Run Code Online (Sandbox Code Playgroud)

如何使用jQuery将'foo'更改为'bar'?

javascript css jquery jquery-selectors pseudo-element

897
推荐指数
14
解决办法
59万
查看次数

使用jQuery访问css":after"选择器

我有以下css:

.pageMenu .active::after {
    content: '';
    margin-top: -6px;
    display: inline-block;
    width: 0px;
    height: 0px;
    border-top: 14px solid white;
    border-left: 14px solid transparent;
    border-bottom: 14px solid white;
    position: absolute;
    right: 0;
}
Run Code Online (Sandbox Code Playgroud)

我想使用jQuery更改顶部,左侧和底部边框的边框宽度.我用什么选择器来访问这个元素?我尝试了以下但它似乎没有工作.

$('.pageMenu .active:after').css(
        {
            'border-top-width': '22px',
            'border-left-width': '22px',
            'border-right-width': '22px'
        }
    )
Run Code Online (Sandbox Code Playgroud)

css jquery jquery-selectors

207
推荐指数
3
解决办法
44万
查看次数