vue-drag-it-dude
Vue2 component, that allows you to drag object wherever you want.
What this can do
- Drag and drop DOM elements inside parent (or document, if parent's size not specified)
- Receive content sizes and update move restrictions
- Move with mouse, or with touch, it's not matter
- Emit active and drag events
Install
via NPM
Usage
or
Don't forget to add position: relative;
for parent element!
Now use it!
Props
width
type: Number
Required: false
Default: 0
If you want to dynamically change inner DOM element width, just type something like:
height
type: Number
Required: false
Default: 0
If you want to dynamically change inner DOM element height, just type something like:
parentWidth
type: Number
Required: false
Default: parentNode.offsetWidth
of draggable element
If you want to limit width of area, within which an element can move:
parentHeight
type: Number
Required: false
Default: parentNode.offsetHeight
of draggable element
If you want to limit height of area, within which an element can move:
Events
activated
Required: false
Called, when element is activated
dragging
Required: false
Called, when element is draggeing
dropped
Required: false
Called, when element release