Skip to content

Instantly share code, notes, and snippets.

@dryan
Created September 21, 2010 03:11
Show Gist options
  • Save dryan/589128 to your computer and use it in GitHub Desktop.
Save dryan/589128 to your computer and use it in GitHub Desktop.
function getElementScale(elem) {
var transform = /matrix\([^\)]+\)/.exec(window.getComputedStyle(elem)['-webkit-transform']),
scale = {'x': 1, 'y': 1};
if( transform ) {
transform = transform[0].replace('matrix(', '').replace(')', '').split(', ');
scale.x = parseFloat(transform[0]);
scale.y = parseFloat(transform[3]);
}
return scale;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment