Measure elements
Pull request Compare This branch is 33 commits behind desandro:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
README.md
bower.json
get-size.js
index.html

README.md

getSize

Get the size of elements.

var size = getSize( elem );
// elem can be an element
var size = getSize( document.querySelector('#selector') )
// elem can be a string, used as a query selector
var size = getSize('#selector')

Returns an object with: width, height, innerWidth/Height, outerWidth/Height, paddingLeft/Top/Right/Bottom, marginLeft/Top/Right/Bottom, borderLeft/Top/Right/BottomWidth and isBorderBox.

Tested in IE8, IE9 and good browsers.

Bower

getSize is a Bower package

bower install desandro/get-size

Fractional values in IE8

For percentage or em-based sizes, IE8 does not support fractional values. getSize will round to the nearest value.