Skip to content

Instantly share code, notes, and snippets.

@zhuzhuaicoding
Created September 30, 2012 02:21
Show Gist options
  • Save zhuzhuaicoding/3805669 to your computer and use it in GitHub Desktop.
Save zhuzhuaicoding/3805669 to your computer and use it in GitHub Desktop.
getCSS style compatitable
function getCss(elem, css){
if (window.getComputedStyle) {
return window.getComputedStyle(elem, null)[css];
}else if (elem.currentStyle) {
return elem.currentStyle[css];
}else {
return elem.style[css];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment