单个触发
drag1
批量触发
设置container
不设置container
绑定事件
//html:
//js:
//单个触发
var dispose1 = drag('#drag1');
//批量触发
var dispose2 = drag('.drag_able', {
targetContainer: '#container2',
handler: '.drag_handler',
proxy: true,
});
//设置container
var dispose3 = drag('.drag_able', {
container:'#container2'
});
//不设置container
var dispose4 = drag('.drag_able', {
targetContainer:'#container4',
container:'null' //默认container为body,传入字符串null代表无container
});
//事件绑定
var dispose5 = drag('.drag_able', {
targetContainer: '#container5',
event: {
dragActive: function (node, start) {
console.log('dragActive', node, start)
},
dragStart: function (node, start) {
console.log('dragStart', node, start)
},
dragMove: function (node, start, end) {
console.log('dragMove', node, start, end)
},
dragEnd: function (node, start, end) {
console.log('dragEnd', node, start, end)
},
}
});