You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
12 years ago
|
/*
|
||
|
* getStyleObject Plugin for jQuery JavaScript Library
|
||
|
* From: http://upshots.org/?p=112
|
||
|
*
|
||
|
* Copyright: Unknown, see source link
|
||
|
* Plugin version by Dakota Schneider (http://hackthetruth.org)
|
||
|
*
|
||
|
* Source: http://stackoverflow.com/a/6416477
|
||
|
*/
|
||
|
|
||
|
(function($){
|
||
|
$.fn.getStyleObject = function(){
|
||
|
var dom = this.get(0);
|
||
|
var style;
|
||
|
var returns = {};
|
||
|
if(window.getComputedStyle){
|
||
|
var camelize = function(a,b){
|
||
|
return b.toUpperCase();
|
||
|
};
|
||
|
style = window.getComputedStyle(dom, null);
|
||
|
for(var i=0;i<style.length;i++){
|
||
|
var prop = style[i];
|
||
|
var camel = prop.replace(/\-([a-z])/g, camelize);
|
||
|
var val = style.getPropertyValue(prop);
|
||
|
returns[camel] = val;
|
||
|
}
|
||
|
return returns;
|
||
|
}
|
||
|
if(dom.currentStyle){
|
||
|
style = dom.currentStyle;
|
||
|
for(var propp in style){
|
||
|
returns[propp] = style[propp];
|
||
|
}
|
||
|
return returns;
|
||
|
}
|
||
|
return this.css();
|
||
|
};
|
||
|
})(jQuery);
|