[英]jQuery Removing ::after css from an element
我有像这样的CSS:
.support-hub .app-detail:after {
content: "";
display: table;
clear: both;
}
萤火虫显示为
.support-hub .app-detail::after {
clear: both;
content: "";
display: table;
}
在我的代码中,我这样做:
$('.support-hub .app-detail:after').css({'display':'inline'});
但是该显示属性未更改。 请帮助。 很少的文档可用于:使用jQuery进行CSS操作后
一种快速的解决方案是将:: after或:: before样式应用于一个类(而不是主元素)并删除e类
这样after
您将无法使用。 从技术上讲,使用jQuery不能访问DOM元素。
只需这样尝试
$('.support-hub .app-detail').css({'display':'inline'});
或者,您可以使用next
jQuery方法或类似的方法来操作DOM元素。
$('.support-hub .app-detail').next().css({'display':'inline'});
请参考此链接
您可以将以下代码添加到CSS中:
.support-hub .app-detail.inline:after {
content: "";
display: inline;
clear: both;
}
您可以从javascript调用此代码:
$('.support-hub .app-detail').addClass('');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.