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

https://github.com/gennnji/svelte-actions-resize

ResizeObserver action for Svelte 3
https://github.com/gennnji/svelte-actions-resize

resizeobserver svelte svelte3

Last synced: about 2 months ago
JSON representation

ResizeObserver action for Svelte 3

Awesome Lists containing this project

README

          

# svelte-actions-resize

ResizeObserver action plugin for [Svelte 3](https://svelte.dev).
Based on ponyfill @juggle/resize-observer.

## Installation

Install with npm or yarn:
```bash
npm install svelte-actions-resize
```
OR
```bash
yarn add svelte-actions-resize
```

## Usage

[DEMO](https://svelte.dev/repl/1a489d85e1fd4609ad86fc51d3b81d69?version=3)

```html

section {
border: 10px solid lightgray;
}

section > div {
border: 2px solid red;
width: 8px;
height: 8px;
background-color: green;
}

import resize from 'svelte-actions-resize';

let elements = [{}];

function handleResize() {
alert('Resize done!');
}

elements = [...elements, {}]}>Resize

{#each elements as element}


{/each}

```

## Options

| Name | Type | Description |
| --- | --- | --- |
| `on:resize` | `Function` | Callback to handle resize |