Skip to content

Usage

Basic Usage

Pass a callback handler to didResize. The handler receives a ResizeObserverEntry and the ResizeObserver instance:

Resize Counter

Count how many times an element has been resized. You can drag the corner handle or use the buttons:

Advanced Usage

didResize also supports passing an options hash as the second positional argument. Options are documented under ResizeObserver.observe:

OptionDescription
boxSets which box model the observer will observe changes to. Possible values are content-box (default), border-box, and device-pixel-content-box.