微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javascript – 触发CSS:非锚元素的主动选择器

如何通过JavaScript(jQuery)触发非锚元素的:active状态?

在查看Section 5.11.3 of the W3C CSS2 specification参考:hover伪选择器以了解触发a的激活时,我遇到了以下情况,这让我相信它应该是可能的:

“The :active pseudo-class applies while an element is being activated by the user. For example, between the times the user presses the mouse button and releases it.”

“CSS does not define which elements may be in the above states, or how the states are entered and left. Scripting may change whether elements react to user events or not, and different devices and UAs may have different ways of pointing to, or activating elements.”

谢谢你的帮助!

解决方法:

你无法触发css伪选择器,如:使用javascript激活.
没有可以执行的函数/处理程序,所以即使你触发了对具有css:active伪选择器集的元素的单击(例如将背景颜色设置为红色),也不会发生任何事情.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐