Skip to content

Instantly share code, notes, and snippets.

@samueljseay
Last active April 7, 2016 19:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samueljseay/13c2e69508563b2f0458 to your computer and use it in GitHub Desktop.
Save samueljseay/13c2e69508563b2f0458 to your computer and use it in GitHub Desktop.
Get real dimensions YUI
function getRealDimensions(node) {
var clone,
result;
if ( ! node ) {
return false;
}
clone = node.cloneNode(true).show().setStyle('visibility','hidden').appendTo('body');
result = {
width: clone.get('offsetWidth'),
height: clone.get('offsetHeight')
};
clone.remove(true);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment