Skip to content

Commit daaefed

Browse files
authored
Merge pull request #2072 from code4fan/master
fix the drag position problem when existing non draggable elements at the end of the list
2 parents b8940a9 + 6bf2914 commit daaefed

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Sortable.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,12 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
11881188

11891189
if (onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
11901190
capture();
1191-
el.appendChild(dragEl);
1191+
if (elLastChild && elLastChild.nextSibling) { // the last draggable element is not the last node
1192+
el.insertBefore(dragEl, elLastChild.nextSibling);
1193+
}
1194+
else {
1195+
el.appendChild(dragEl);
1196+
}
11921197
parentEl = el; // actualization
11931198

11941199
changed();

0 commit comments

Comments
 (0)