npm

lessaber-drag-div

0.0.2 • Public • Published

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

  1. 可以拖拽的区域受到父元素的限制 - The area that can be dragged is restricted by the parent element

  2. callbackFn 鼠标拖拽时触发 - when the mouse is dragging

  3. target 需要设置 position: absolute/reletive; - Target needs to set position: absolute/reletive;

原型来自张鑫旭的博客 地址-address

Readme

Keywords

none

Package Sidebar

Install

npm i lessaber-drag-div

Weekly Downloads

2

Version

0.0.2

License

none

Unpacked Size

5.99 kB

Total Files

4

Last publish

Collaborators

  • lessaber