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

https://github.com/xty1992a/resizable


https://github.com/xty1992a/resizable

Last synced: 5 days ago
JSON representation

Awesome Lists containing this project

README

        

## Install
`pnpm i @redbuck/resizable`

## Usage

[Live Demo](https://codepen.io/xty1992a/pen/KKjxKwq)

```html










import Resizable from '../dist/es/index.js'

const resizer = new Resizable('#box')

resizer.on('effect', console.log)

```

## API

### options
| Method | Description | default |
| ----- |--------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
| container | The container element or selector | - |
| itemClassName | Which child element under el will effect | resize-item |
| effectManual | Should resizer instance effect dom manual | false |
| getItemOnStart | When drag start, carry the touched element call this function to get which item should be effect | find ancestors(include self) which one`s classList contain itemClassName |
| getEffectOnStart | When drag start, carry the touched element call this function to get effect in this drag | el => el.dataset.effect.split(',') |
| getPointsOnStart | When drag start, carry the touched element call this function to get initial points in this drag | Resizable.getPoints |
| listenerFactory | You can use this option to provide your own Listener | web-listener |

### events
| Method | Description |
| ----- |----------------------------------------------------------|
| effect | Emitted when drag move , carry the target and it`s shape |