jquery - 如何得到:hover css style of an anchor with jQuery?

标签 jquery css hover anchor

如何使用 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/

相关文章:

javascript - jQuery 显示数组项给我 [object, Object]

html - 缩放背景图像

css - JSF 2 panelGrid 列格式 - 统一对齐

jQuery 滑动菜单悬停操作

css - IE 悬停/焦点/事件 anchor 和跨度,无 javascript

未找到 Javascript/jQuery Google map 路线

jquery - 无法在 "click"事件上打开 jQuery 对话框

internet-explorer - 如何使 "background-size"在 IE8 中工作?

css - 只能让 CSS 下拉菜单出现在悬停时

javascript - d3 SVG Line 元素不触发 onclick 事件