diff --git a/knockout-sortable.js b/knockout-sortable.js index fedcff7..3c9b99f 100644 --- a/knockout-sortable.js +++ b/knockout-sortable.js @@ -138,7 +138,11 @@ // drop an item above the 3rd visible item, but the 2nd visible item // has an actual index of 5. if (e.item.previousElementSibling) { - newIndex = to().indexOf(ko.dataFor(e.item.previousElementSibling)) + 1; + newIndex = to().indexOf(ko.dataFor(e.item.previousElementSibling)); + + if (newIndex < originalIndex) { + newIndex++; + } } // Remove sortables "unbound" element