# element-resize-events.js

> Enabels listening to resize events on any HTMLElement

Latest version **1.0.1** (published 2020-07-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install element-resize-events.js
pnpm add element-resize-events.js
yarn add element-resize-events.js
bun add element-resize-events.js
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-07-02 |
| First published | 2020-07-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Roshan Kharel |
| Maintainers | kharel |
| Keywords | HTMLElement event, Resize Event |

## Links

- npm: https://www.npmjs.com/package/element-resize-events.js
- npm.io page: https://npm.io/package/element-resize-events.js

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-07-02
- 1.0.0 — 2020-07-02

## README

# Intro

Enabels listening to resize events on any HTMLElement

# How to use

## Listening Resize Event

``` html
<style>
    body {
        padding: 10px;
    }

    .resizable {
        margin: 0 auto;
        width: 200px;
        height: 100px;
        border: 2px solid red;

        /* Makes HTMLElement Resizable*/
        resize: both;
        overflow: auto;
    }
</style>

<div class="resizable"></div>
```

``` javascript
const element = document.querySelectorAll('.resizable');

// add this line to listen for resize event
ObserveResize.subscribe(element);

element.addEventListener("resize", function(event) {
    console.log(event);
});
```

## Stop Listening Resize Event

``` javascript
ObserveResize.unsubscribe(element);

// or 
const unsubscribe = ObserveResize.subscribe(element);
unsubscribe();
```

---
_Source: https://npm.io/package/element-resize-events.js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
