sortableJS/temp.js

20 lines
545 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var g1 = document.getElementById('g1');
var ops1 = {
animation: 1000,
delay: 30,
draggable: '.item',
//被禁止拖动的元素,第二个元素不允许被拖动
filter: function (evt, item) {
if (item.dataset.id == '2') return true;
return false;
},
//拖动结束
onEnd: function (evt) {
console.log(evt);
//获取拖动后的排序
var arr = sortable1.toArray();
document.getElementById('msg').innerHTML = 'A组排序结果' + JSON.stringify(arr);
},
};
var sortable1 = Sortable.create(g1, ops1);