document-height
Utility to return the height of the current document
Installation
Install via npm.
$ npm i document-height --save
Usage
Require and call as needed.
Document height is cached, so there's likely no reason to hang on to the returned value within your implementation (except to save a function call).
To clear the cache, you must pass a true
parameter.
var docHeight = ; // Assuming a 1000px tall document...console; // logs 1000 // At some point the height of the document// changes to 1500px - the module will still// return its cached value of 1000console; // logs 1000 // to re-measure, pass a truthy valueconsole; // logs 1500
Tests
Tests are mocha browser-based, and can be run via:
npm i && npm run build && npm test
A test coverage report can be generated via:
npm run coverage && open coverage/lcov-report/index.html