使用jQuery获取*所有* CSS属性 [英] Get *all* CSS attributes with jQuery
问题描述
以下是使用jQuery获取一个css属性的方法:
$('someObject')css c $ c>
如何获得他们全部? (未指定,最好采用以下格式,以便以后可以重新应用jQuery):
cssObj = {
/ pre>
'overflow':'hidden',
'height':'100%',
'position':'absolute',
}
谢谢!
EDIT b
我试图获得的方法是在样式表中声明的(它们不是内联的)。对不指定。
解决方案这样的事情:
这是丑陋的,但它似乎工作的海报...
这也可能是感兴趣的:
https://developer.mozilla.org/en/DOM:window.getComputedStyleHere's how you get one css attribute using jQuery:
$('someObject').css('attribute')
How do you get them all? (without specifying and preferably in the following format so it can be reapplied with jQuery later):
cssObj = { 'overflow':'hidden', 'height':'100%', 'position':'absolute', }
Thanks!!
EDIT
The methods I'm trying to get are declared in a style sheet (they are not inline). Sorry for not specifying.
解决方案What about something like this:
It is ugly, but it appeared to work for the poster...
This also may be of interest: https://developer.mozilla.org/en/DOM:window.getComputedStyle
这篇关于使用jQuery获取*所有* CSS属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!