Resize-observer-polyfill

resize-observer-polyfill

A polyfill for Resize Observer API.

Implements event based tracking of changes in the dimensions of elements.

Uses MutationsObserver and falls back to an infinite dirty checking cycle if the first one is not supported.

Handles long running CSS transitions/animations, attributes and nodes mutations along with changes made by :hover pseudo-class (optional).

Compliant with the spec.

Doesn't contain any publicly available methods except for those described in the spec.

Get it:

1
npm install --save resize-observer-polyfill

Sample usage:

1
2
3
4
5
import ResizeObserver from 'resize-observer-polyfill';

const observer = new ResizeObserver((entries, observer) => {});

observer.observe(document.body);

GIF FTW!

resize-observer-polyfill

P.S: Checkout the Live demo.

Suggest a module

Comments