Skip to content

jianyuxudeng/drag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

这个插件主要是封装了手机端和pc端浏览器事件兼容和拖动效果

npm install drag-event-mp --save-dev

import {drag,handleType,eventType} from 'drag-event-mp';

实例化拖拽操作;

handleType

handleType({obj:document,eventType:event,callback:callback,syType:false}).handleType实例化事件点击。兼容模式

eventType;

handleStart,handleMove,handleLeave,handleUp 事件兼容,兼容pc端和mobile端;

对应mousedown,touchstart;mousemove,touchmove,mouseleave,touchend,mouseup,touchcancel;

isMobile 判断是否是手机浏览器

drag({obj:obj,eobj:eobj,clone:true,type:double,moveCallback:moveCallback,endCallback:endCallback,class:class})

obj:拖动元素

eobj:拖动到目标元素

config:json格式;包含conig={clone:true or false 拖动元素是否是clone方式放入目标元素里面还是本身放置, type:double or others 是否开启拖动元素到另外一个元素里面, class:class name 拖动结束之后拖动元素的动画效果}

About

a drag module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published