Observes resizing of an element using a hidden iframe.
npm i -S simple-element-resize-detector
;// any DOM element that can have childrenlet element = document;// listen for resize;
To stop observing resize events, simply remove the returned detector frame:
let detector = ;detector;// or, for better browser compatibility:// detector.parentNode.removeChild(detector)
position: relativestyle to be correctly observed, otherwise nearest relative ancestor will be observed instead.
- This library uses
<iframe>s to detect when an element resizes.
<iframe>s are heavy objects are usually take good amount of memory. Be careful and don't abuse it.