Resize Observer in JavaScript

The ResizeObserver reports changes to the dimensions of an Element's content or border box, or the bounding box of an SVGElement.

In a simple term, when you change a div element's width. You can observe the changes and do some stuff.

See the Pen ResizeObserver demo by Thien Nguyen (@tatthien) on CodePen.