Created
October 27, 2012 06:20
-
-
Save zhuzhuaicoding/3963191 to your computer and use it in GitHub Desktop.
getStyle compatibility
This file contains hidden or 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
| /* It is not possible to get certain styles set in css such as display using | |
| the normal javascript. So we have to use this function taken from: | |
| http://www.quirksmode.org/dom/getstyles.html */ | |
| function getStyle(el,styleProp) | |
| { | |
| var x = document.getElementById(el); | |
| if (x.currentStyle) // IE | |
| var y = x.currentStyle[styleProp]; | |
| else if (window.getComputedStyle) // FF | |
| var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp); | |
| return y; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment