https://github.com/wahaha2012/dom-resizeable
make dom resizeable
https://github.com/wahaha2012/dom-resizeable
dom resize resizeable
Last synced: about 1 year ago
JSON representation
make dom resizeable
- Host: GitHub
- URL: https://github.com/wahaha2012/dom-resizeable
- Owner: wahaha2012
- License: mit
- Created: 2021-10-08T10:18:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-13T09:24:43.000Z (over 4 years ago)
- Last Synced: 2024-03-29T13:02:55.079Z (about 2 years ago)
- Topics: dom, resize, resizeable
- Language: JavaScript
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dom-resizeable
Make dom resizeable
## Snapshot

## Usage
```bash
yarn add dom-resizeable
npm install dom-resizeable
```
```js
// use as commonjs
const Resize = require("dom-resizeable");
// use as ES module
import Resize from "dom-resizeable";
// create resize control ui
const resizeControl = new Resize(document.body, {
width: 100,
height: 100,
dragable: true,
});
const div = document.querySelector("#div");
// bind resize control ui to dom element
resizeControl.bindEditTarget(div);
```
## API
```js
const instance = new Resize(container, options);
// parent element for mount resize ui dom
container
// resize ui config
options = {
width: 0, // ui control default width
height: 0, // ui control default height
draggable: false, // ui control can be drag move
hideCheckIcon: false, // whether hide confirm icon
handleSize: 8, // ui control handle size(px)
onConfirm(e) {
// confirm icon clicked
},
}
instance.bindEditTarget(domElement, options)
// target dom element to resize
domElement
// element resize config
options = {
lockAspectRatio: false, // whether lock aspect ratio when resizing
}
```
## Related Projects
+ https://github.com/daybrush/moveable
+ https://github.com/easylogic/editor
+ https://github.com/fabricjs/fabric.js