实现拖放的JS库:dragula
fdwm
10年前
dragula让你能够很方便地实现拖拽功能的JS库。
特性
- 超级易于使用
- 没有臃肿的依赖
- 计算出自身的排序顺序
- A shadow where the item would be dropped offers visual feedback
- 触摸事件!
dragula(containers, { moves: function (el, container) { return true; // elements are always draggable by default }, accepts: function (el, target, source, sibling) { return true; // elements can be dropped in any of the `containers` by default }, direction: 'vertical', // Y axis is considered when determining where an element would be dropped copy: false, // elements are moved by default, not copied revertOnSpill: false, // spilling will put the element back where it was dragged from, if this is true removeOnSpill: false // spilling will `.remove` the element, if this is true });