Skip to content

Commit 630135c

Browse files
authored
Update knockout-sortable.js
1 parent 9b07d7d commit 630135c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

knockout-sortable.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@
138138
// drop an item above the 3rd visible item, but the 2nd visible item
139139
// has an actual index of 5.
140140
if (e.item.previousElementSibling) {
141-
newIndex = to().indexOf(ko.dataFor(e.item.previousElementSibling)) + 1;
141+
newIndex = to().indexOf(ko.dataFor(e.item.previousElementSibling));
142+
143+
if (newIndex < originalIndex) {
144+
newIndex++;
145+
}
142146
}
143147

144148
// Remove sortables "unbound" element

0 commit comments

Comments
 (0)