Browse Source

#687: fixed 'parentEl'

pull/699/head
RubaXa 9 years ago
parent
commit
92a7deae2a
  1. 7
      Sortable.js

7
Sortable.js

@ -260,10 +260,12 @@
target = (touch || evt).target, target = (touch || evt).target,
originalTarget = target, originalTarget = target,
filter = options.filter; filter = options.filter;
// don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
// Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
if (dragEl) { if (dragEl) {
return; return;
} }
if (type === 'mousedown' && evt.button !== 0 || options.disabled) { if (type === 'mousedown' && evt.button !== 0 || options.disabled) {
return; // only left button or enabled return; // only left button or enabled
} }
@ -278,7 +280,7 @@
return; return;
} }
// get the index of the dragged element within its parent // Get the index of the dragged element within its parent
oldIndex = _index(target, options.draggable); oldIndex = _index(target, options.draggable);
// Check filter // Check filter
@ -613,6 +615,7 @@
if (revert) { if (revert) {
_cloneHide(true); _cloneHide(true);
parentEl = rootEl; // actualization
if (cloneEl || nextEl) { if (cloneEl || nextEl) {
rootEl.insertBefore(dragEl, cloneEl || nextEl); rootEl.insertBefore(dragEl, cloneEl || nextEl);

Loading…
Cancel
Save