Library to make it easy to listen for element resize events
Code borrowed from a blog post by backalleycoder.com.
npm install element-resize-event
This library depends on the availability of requestAnimationFrame
and cancelAnimationFrame
var elementResizeEvent = require("element-resize-event")
var element = document.getElementById("resize")
elementResizeEvent(element, function () {
console.log("resized!")
console.log(element.offsetWidth)
})
var unbind = require("element-resize-event").unbind
unbind(element)