Added the accounting-dragged class to replace the list-group-item-dark class when reordering with drag-and-drop, because the dragged list may not be a list group.

This commit is contained in:
依瑪貓 2023-02-26 07:44:48 +08:00
parent 652bddc07a
commit d98e9f8f05
2 changed files with 8 additions and 4 deletions

View File

@ -34,6 +34,10 @@
color: inherit;
padding-right: 0;
}
.accounting-dragged {
color: #141619;
background-color: #D3D3D4;
}
/** The card layout */
.accounting-card {

View File

@ -46,14 +46,14 @@ function initializeMouseDragAndDropReordering(list, onReorder) {
item.draggable = true;
item.addEventListener("dragstart", function () {
dragged = item;
dragged.classList.add("list-group-item-dark");
dragged.classList.add("accounting-dragged");
});
item.addEventListener("dragover", function () {
onDragOver(dragged, item);
onReorder();
});
item.addEventListener("dragend", function () {
dragged.classList.remove("list-group-item-dark");
dragged.classList.remove("accounting-dragged");
dragged = null;
});
});
@ -70,7 +70,7 @@ function initializeTouchDragAndDropReordering(list, onReorder) {
const items = Array.from(list.children);
items.forEach(function (item) {
item.addEventListener("touchstart", function () {
item.classList.add("list-group-item-dark");
item.classList.add("accounting-dragged");
});
item.addEventListener("touchmove", function (event) {
const touch = event.targetTouches[0];
@ -79,7 +79,7 @@ function initializeTouchDragAndDropReordering(list, onReorder) {
onReorder();
});
item.addEventListener("touchend", function () {
item.classList.remove("list-group-item-dark");
item.classList.remove("accounting-dragged");
});
});
}