Created
July 17, 2023 08:40
-
-
Save codeallday31/04b0f215040663f0e09cac66942b0879 to your computer and use it in GitHub Desktop.
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
function elementGetStyle(element, style) { | |
var value = element.style[style]; | |
if (!value) { | |
if (document.defaultView && document.defaultView.getComputedStyle) { | |
var css = document.defaultView.getComputedStyle(element, null); | |
value = css ? css.getPropertyValue(style) : null; | |
} else if (element.currentStyle) { | |
value = element.currentStyle[style]; | |
} | |
} | |
return value == 'auto' ? null : value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment