$ npm install viewport-dimensions
Simple utility for watching and retrieving browser viewport width, height, vmin and vmax.
documentElement.clientWidth
is used (rather than window.innerWidth
), so reported viewport dimensions will exclude scrollbar dimensions.
bower install -S viewport-dimensions
npm i -S viewport-dimensions
(One object is exported:)
var viewport = require('viewport');
Returns {number} - Browser viewport width.
viewport.width(); // (e.g.) 1024
Returns {number} - Browser viewport height.
viewport.height(); // (e.g.) 768
Returns {number} - Maximum browser dimension (width/height).
viewport.max(); // (e.g.) 1024
Returns {number} - Minimum browser dimension (width/height).
viewport.height(); // (e.g.) 768
Set internal dimension references to current browser viewport width and height.
viewport.setDimensions();
Won't generate errors if run server-side, but won't do anything too useful either.
npm install
gulp lint
) & tests (gulp test
) pass (combined task: gulp dev
)gulp dist
) - combined dev + dist task: gulp
Use gulp watch
to run linter and tests on each file change (equivalent to manually running gulp dev
).
© 2010 - cnpmjs.org x YWFE | Home | YWFE