ElementMeasurer
The javascript library class for measures size of Element.
Install
npm install element-measurer
Usage
import ElementMeasurer from 'element-measurer';
const targetSize = new ElementMeasurer('#target');
let max = targetSize.maxScrollTop;
const docSize = new ElementMeasurer(document);
docSize.scrollTop = 200;
API
Properties
- clientWidth:
ReadOnly
Returns inner width of an element in pixels. - clientHeight:
ReadOnly
Returns inner height of an element in pixels. - scrollTop: Gets or sets of pixels that an element's content is scrolled vertically.
- scrollLeft: Gets or sets the number of pixels that an element's content is scrolled to the left.
- scrollWidth:
ReadOnly
Returns the width of the entire content of an element. - scrollHeight:
ReadOnly
Returns the height of the entire content of an element. - maxScrollTop:
ReadOnly
Returns maximum top scroll offset possible for the element. - maxScrollLeft:
ReadOnly
Returns maximum left scroll offset possible for the element.
Methods
setTarget
Set target element.
getOffset
Returns top and left values that indicates offset distance to html document.
License
MIT License