Created
January 17, 2012 09:29
-
-
Save ethertank/1625854 to your computer and use it in GitHub Desktop.
getComputedStyle(function)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(typeof getComputedStyle === "undefined") { | |
var getComputedStyle = function(targetElm){ | |
return document.defaultView.getComputedStyle(targetElm, "") || targetElm.currentStyle; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
※ネイティブの getComputedStyle は擬似要素の指定も可能だが、この関数では不可。 | |
## usage ## | |
var bodyStyles = getComputedStyle(document.body); | |
console.log(bodyStyles["color"]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment