Cross-browser JavaScript dimensions module
$ npm install dime
dime.width(object) // get width
dime.height(object) // get height
dime.width(element, px) // set width
dime.height(element, px) // set height
window
document
or element.width
/.height
properties or methods
dime.width(screen) // => screen.width
dime.width({width:10, height:10}) // => 10
.width() // get the width of the 1st elem in the set
.width(value) // set the width of all elems in the set
.height() // get the width of the 1st elem in the set
.height(value) // set the width of all elems in the set
$(window).width()
$(document).width()
$(element).width()
$(element).width(100)
dime.fn.width.call(stack)
dime.fn.width.call(stack, px)
It is only sensible to use these for setting dimensions—the statics are faster for gets.
dime.fn.width.call([document]) // same as dime.width(document)
dime.fn.width.call(document.querySelectorAll('.example'), 100)
screen
provides these.dime.width(window)
although those methodsdime
is a plain object—not a wrapper function.Copyright (C) 2012 by Ryan Van Etten