Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/KyleAMathews/element-resize-event
Library to make it easy to listen for element resize events
https://github.com/KyleAMathews/element-resize-event
Last synced: 15 days ago
JSON representation
Library to make it easy to listen for element resize events
- Host: GitHub
- URL: https://github.com/KyleAMathews/element-resize-event
- Owner: KyleAMathews
- License: mit
- Created: 2014-10-04T21:35:55.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-12-23T18:08:49.000Z (almost 3 years ago)
- Last Synced: 2024-10-14T12:59:42.601Z (29 days ago)
- Language: JavaScript
- Homepage: http://kyleamathews.github.io/element-resize-event/
- Size: 43.9 KB
- Stars: 175
- Watchers: 9
- Forks: 44
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# element-resize-event
Library to make it easy to listen for element resize events
Code borrowed from a [blog post by
backalleycoder.com](http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/).## Install
`npm install element-resize-event`
## Dependencies
This library depends on the availability of `requestAnimationFrame` and `cancelAnimationFrame`
## Usage
```javascript
var elementResizeEvent = require("element-resize-event")var element = document.getElementById("resize")
elementResizeEvent(element, function () {
console.log("resized!")
console.log(element.offsetWidth)
})
```### Unbinding The Event Listener
```javascript
var unbind = require("element-resize-event").unbindunbind(element)
```