dom-resize

1.0.3 • Public • Published

Library to make it easy to listen for element resize events

Forked from: https://github.com/KyleAMathews/element-resize-event

Install

npm install dom-resize

Dependencies

This library depends on the availability of requestAnimationFrame and cancelAnimationFrame

Usage

import { resizeListen, resizeUnlisten } from 'dom-resize'
 
const target = document.getElementById("target")
 
// Subscribe to resize event
resizeListen(target, () => {
  console.log("resized!");
  console.log(target.offsetWidth);
});
 
// Unsubscribe event
resizeUnlisten(target)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    3,236
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    3,236
  • 1.0.2
    2
  • 1.0.0
    1

Package Sidebar

Install

npm i dom-resize

Weekly Downloads

3,239

Version

1.0.3

License

MIT

Last publish

Collaborators

  • drcmda