Get Object Dimensions
Java Method
javaElement.getBoundingClientRect()
method will return an object containing the width, height, and some other useful values:
java{ width: 960, height: 71, top: 603, bottom: 674, left: 360, right: 1320 }
Get the values separated in variables:
javavar element = document.getElementById('foo'); var positionInfo = element.getBoundingClientRect(); var height = positionInfo.height; var width = positionInfo.width;
Look at the source for more methods and related discussions.