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

https://github.com/ruslang02/drag-resize

Drag and resize element library
https://github.com/ruslang02/drag-resize

Last synced: about 2 months ago
JSON representation

Drag and resize element library

Awesome Lists containing this project

README

        

# Drag-resize JS library

For moving and resizing elements, only VanillaJS, maximum performance

Electron is _not_ required.

### Brief usage info

**new Draggable(element, options)**

- element - DOMNode to make draggable
- options

- handle - selector of nodes to trigger draggable _!important_
- cancel - selector of nodes that cancel triggering drag

**new Resizable(element, options)**

- element - DOMNode to make resizable
- options

- triggerSize - _integer_, size in PX of resize triggers
- edges: {top: _bool_, left: _bool_, right: _bool_, bottom: _bool_}, controls where to put triggers
### Example
```html


Hey, this is a title

I am not triggering drag
But I do!


#forceDrag {width:50px;height:50px;border:2px solid black;}

```
```javascript
new Draggable(document.querySelector("#window"), {
cancel: "main",
handle: "#dragArea"
});
new Resizable(document.querySelector("#window"), {
edges: {
top: true,
left:true,
bottom:true,
right:true
}
});
```