在jquery中了解伪元素的限制:访问“ selector
尝试修改“:”选择器的CSS属性时,您可能会遇到困难。 This is because pseudo-elements are not part of the DOM (Document Object Model) and are therefore inaccessible via direct JavaScript methods.
Solution: Introducing a Class with New ":after" PropertiesTo overcome this limitation, you can create a new CSS class that specifies the desired modifications to the ":after" selector.此类的特异性将比原始“:after”规则更高,允许其覆盖默认设置。
例如:jquery: $('。pagemenu .Active')。toggleclass('flose''');
通过将“更改”类添加到所需元素中,您有效地在“:”之后指定的“:”属性。 css。注意:
很重要的是,请记住,在操纵“:”之后,“元素通常不可能直接使用,因此,有些技术可以允许您阅读和覆盖其属性。有关这些方法的全面信息,请参阅外部资源。免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3