Skip to content

Instantly share code, notes, and snippets.

@fredyang
Created December 31, 2014 15:27
Show Gist options
  • Save fredyang/5cd8e6a5ed03a7ed8ad1 to your computer and use it in GitHub Desktop.
Save fredyang/5cd8e6a5ed03a7ed8ad1 to your computer and use it in GitHub Desktop.
get current style for element
function getStyle(element, key) {
var node = element[0];
return node.currentStyle ?
node.currentStyle[key] :
$window.getComputedStyle(node)[key];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment