1.0.1 • Published 1 year ago
hyw-drag v1.0.1
简易拖拽插件
实现拖拽交互dom位置,抛出回调和信息
参数:
参数只有一个,那就是大盒子的DOM,如果有俩个大盒子id,可以构成购物车的简易效果
案例:
HTML:
<div class="drag-box" id="drag-box">
<div class="drag-items" style="top: -20px">1</div>
<div class="drag-items">2</div>
<div class="drag-items">3</div>
<div class="drag-items">4</div>
</div>
//购物车
<div class="_drag-box" id="_drag-box">
import createDraw from "./Draw";
let draw = createDraw('drag-box')
draw.start(function (info,e){
console.log('start')
})
draw.end(function (info,e){
console.log('end')
})
draw.enter(function (info,e){
console.log('enter')
})
draw.over(function (info,e){
console.log('over')
})
draw.drop(function (info,e){
console.log('drop')
})
//也可以这样实现简易购物车
let draw = createDraw({
source:'drag-box',
target:'_drag-box'
})
版本
v1.0.0