Created
July 27, 2014 07:59
-
-
Save hehongwei44/b524ff25991d99625eb2 to your computer and use it in GitHub Desktop.
获取元素当前的高度和宽度
This file contains 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 getHeight(elem) { | |
return parseInt(getStyle(elem, 'height')); | |
} | |
/** | |
* 获取元素的真实宽度 | |
* */ | |
function getWidth(elem) { | |
return parseInt(getStyle(elem, 'width')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
getStyle函数依赖:https://gist.github.com/hehongwei44/9abf63536accd0f2eeb7