Skip to content

Commit 70bf5fd

Browse files
author
TJ Draper
committed
Fix helper positioning bug when window scrolled
1 parent 41fc8ca commit 70bf5fd

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

jquery.mjs.nestedSortable.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
this.helper[0].style.left = this.position.left + "px";
246246
}
247247
if (!this.options.axis || this.options.axis !== "x") {
248-
this.helper[0].style.top = this.position.top + "px";
248+
this.helper[0].style.top = (this.position.top + window.scrollY) + "px";
249249
}
250250

251251
// mjs - check and reset hovering state at each cycle
@@ -650,7 +650,7 @@
650650
this._sort_current === this._uiHash().item.index())) {
651651
this._trigger("relocate", this._relocate_event, this._uiHash());
652652
}
653-
653+
654654
// mjs - clean last empty ul/ol
655655
for (i = this.items.length - 1; i >= 0; i--) {
656656
item = this.items[i].item[0];
@@ -799,32 +799,32 @@
799799
if (swap) {
800800
search = [replace, replace = search][0];
801801
}
802-
802+
803803
$(elem).removeClass(search).addClass(replace);
804804
}
805-
805+
806806
var o = this.options,
807807
childrenList = $(item).children(o.listType),
808808
hasChildren = childrenList.is(':not(:empty)');
809-
809+
810810
var doNotClear =
811811
o.doNotClear ||
812812
hasChildren ||
813813
o.protectRoot && $(item)[0] === this.element[0];
814-
814+
815815
if (o.isTree) {
816816
replaceClass(item, o.branchClass, o.leafClass, doNotClear);
817-
817+
818818
if (doNotClear && hasChildren) {
819819
replaceClass(item, o.collapsedClass, o.expandedClass);
820820
}
821821
}
822-
822+
823823
if (!doNotClear) {
824824
childrenList.remove();
825825
}
826826
},
827-
827+
828828
_getLevel: function(item) {
829829

830830
var level = 1,

0 commit comments

Comments
 (0)