mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Sortable: Fixed jerkiness with nested-sortables. Fixes #4857 - Nested lists don't work properly with sortable.
This commit is contained in:
parent
651460792b
commit
2b899cc843
11
ui/jquery.ui.sortable.js
vendored
11
ui/jquery.ui.sortable.js
vendored
@ -296,7 +296,16 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|||||||
var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
|
var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
|
||||||
if (!intersection) continue;
|
if (!intersection) continue;
|
||||||
|
|
||||||
if(itemElement != this.currentItem[0] //cannot intersect with itself
|
// Only put the placeholder inside the current Container, skip all
|
||||||
|
// items form other containers. This works because when moving
|
||||||
|
// an item from one container to another the
|
||||||
|
// currentContainer is switched before the placeholder is moved.
|
||||||
|
//
|
||||||
|
// Without this moving items in "sub-sortables" can cause the placeholder to jitter
|
||||||
|
// beetween the outer and inner container.
|
||||||
|
if (item.instance !== this.currentContainer) continue;
|
||||||
|
|
||||||
|
if (itemElement != this.currentItem[0] //cannot intersect with itself
|
||||||
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
|
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
|
||||||
&& !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
|
&& !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
|
||||||
&& (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
|
&& (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
|
||||||
|
Loading…
Reference in New Issue
Block a user