An open API service indexing awesome lists of open source software.

https://github.com/konglingwen94/element-resize-event-polyfill

:eye: Native event listener polyfill to capture element size chang
https://github.com/konglingwen94/element-resize-event-polyfill

element-resize element-resize-observer native-resize resize resize-event resize-observer

Last synced: about 1 month ago
JSON representation

:eye: Native event listener polyfill to capture element size chang

Awesome Lists containing this project

README

        

# element-resize-event-polyfill

Native event listener polyfill to capture element size changes

## Live Demo
>https://konglingwen94.github.io/element-resize-event-polyfill/dist/demo.html

## Install

```bash
npm install element-resize-event-polyfill --save-dev
```

### Usage

Example in es6

```javascript
import 'element-resize-event-polyfill'

const elm = document.getElementById('#elm')

elm.addEventListener('resize', handler)
```

Example in browser

```HTML

My size changes can be captured

const elm=document.getElementById("elm")

// case one
elm.addEventListener("resize",function(e){
// Your logic
})

// case two
elm.onresize=function(e){
// Your logic
}

```

Example in vue

```HTML

export default {
methods:{
handlerResize(e){
// Your code
}
}
}

```

> Example in cdn

```HTML


const elm = document.getElementById('container')

elm.addEventListener('resize', function(e) {
// Your code
})