28 lines
956 B
JavaScript
28 lines
956 B
JavaScript
var count = 2; toMoveID = 0, newIndex = 0;;
|
|
var insert = "";
|
|
|
|
var drake = dragula()
|
|
.on('drag', function (el) {
|
|
toMoveID = parseInt(el.getAttribute("tabID"));
|
|
el.className = el.className.replace('ex-moved', '');
|
|
}).on('drop', function (el, container) {
|
|
var subCont = document.getElementById("listZone");
|
|
var size = subCont.children.length;
|
|
|
|
for (var i = 0; i < size; i++) {
|
|
if (subCont.children[i].getAttribute("tabID") == toMoveID) {
|
|
newIndex = i;
|
|
}
|
|
}
|
|
|
|
tabsAction.move(toMoveID, {index: newIndex}).then();
|
|
el.className += ' ex-moved';
|
|
}).on('over', function (el, container) {
|
|
container.className += ' ex-over';
|
|
}).on('out', function (el, container) {
|
|
container.className = container.className.replace('ex-over', '');
|
|
});
|
|
|
|
// Connect to pre created containers
|
|
drake.containers.push(document.querySelector('#listZone'));
|