lessaber-drag-div
v0.0.2
Published
make Div can be dragged
Downloads
4
Readme
lessaber-drag-div
拖拽div插件 - make Div can be dragged
GitHub
https://github.com/lessaber/lessaber-drag-div
用法 usage
npm install lessaber-drag-div
import drag from 'lessaber-drag-div'
var bar = document.querySelector('#bar') // 拖拽区域 - drop zones
var target = document.querySelector('#target') //移动的元素 - The moving element
drag(bar, target, callbackFn = null)
功能 function
使div可以拖拽 - make Div can be dragged
div会被限制在窗口显示范围内 - The div is limited to the window display
双击bar区域恢复原来位置 - Double-click the bar area to restore the original location
注意 attention
可以拖拽的区域受到父元素的限制 - The area that can be dragged is restricted by the parent element
callbackFn 鼠标拖拽时触发 - when the mouse is dragging
target 需要设置 position: absolute/reletive; - Target needs to set position: absolute/reletive;