Last active
April 7, 2016 19:13
-
-
Save samueljseay/13c2e69508563b2f0458 to your computer and use it in GitHub Desktop.
Get real dimensions YUI
This file contains hidden or 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 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