Element height observer
This library allows you to add an observer for page or element height. Each time the page changes height, a callback will be called.
No dependencies, total library minified is less than 700 bytes
Install
npm install element-height-observer --save
Use
When the page has loaded, you can register the oberver like this:
window.addEventListener('load', function () {
var someElement = document.querySelector('#someElementId');
registerHeightObserver(someElement, function () {
})
});
You can only add one listener per element, otherwise the unregister mechanism won't work correctly.
var someElement = document.querySelector('#someElementId');
unregisterHeightObserver(someElement);
Inspiration
This library is inspired by a stackoverflow post by Jake