如何使用 jquery 在 css 样式表中动态获取 :hover?
愚蠢的例子:
a.foo {
color: red;
font-size: 11px;
}
a.foo:hover {
color: blue;
font-size: 12px;
}
如何在鼠标越过 anchor 之前检索颜色和字体大小?
最佳答案
如果确实需要,您可以通过 document.styleSheet 属性访问此信息。此处提供示例:http://jsfiddle.net/Xm2zU/1/
请注意,IE 需要自己的代码来执行此操作,因为它使用“.rules”而不是“.cssRules”等。
关于jquery - 如何得到:hover css style of an anchor with jQuery?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/654295/