You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
evt.willInsertAfter; // Boolean that is true if Sortable will insert drag element after target by default
172
183
originalEvent.clientY; // mouse position
173
184
// return false; — for cancel
185
+
// return -1; — insert before target
186
+
// return 1; — insert after target
174
187
},
175
188
176
189
// Called when creating a clone of element
177
190
onClone:function (/**Event*/evt) {
178
191
var origEl =evt.item;
179
192
var cloneEl =evt.clone;
193
+
},
194
+
195
+
// Called when dragging element changes position
196
+
onChange:function(/**Event*/evt) {
197
+
evt.newIndex// most likely why this event is used is to get the dragging element's current index
198
+
// same properties as onEnd
180
199
}
181
200
});
182
201
```
@@ -191,7 +210,7 @@ You can also define whether lists can give away, give and keep a copy (`clone`),
191
210
192
211
* name: `String` — group name
193
212
* pull: `true|false|["foo", "bar"]|'clone'|function` — ability to move from the list. `clone` — copy the item, rather than move. Or an array of group names which the elements may be put in. Defaults to `true`.
194
-
* put: `true|false|["baz", "qux"]|function` — whether elements can be added from other lists, or an array of group names from which elements can be taken.
213
+
* put: `true|false|["baz", "qux"]|function` — whether elements can be added from other lists, or an array of group names from which elements can be added.
195
214
* revertClone: `boolean` — revert cloned element to initial position after moving to a another list.
196
215
197
216
@@ -227,6 +246,8 @@ Percentage of the target that the swap zone will take up, as a float between `0`
If set to `true`, the dragover event will bubble to parent Sortables. Useful for nested Sortables. Works on both fallback and native dragover event.
498
+
If set to `true`, the dragover event will bubble to parent sortables. Works on both fallback and native dragover event.
499
+
By default, it is false, but Sortable will only stop bubbling the event once the element has been inserted into a parent Sortable, or *can* be inserted into a parent Sortable, but isn't at that specific time (due to animation, etc).
500
+
501
+
Since 1.8.0, you will probably want to leave this option as false. Before 1.8.0, it may need to be `true` for nested sortables to work.
502
+
503
+
504
+
---
505
+
506
+
507
+
#### `removeCloneOnHide` option
508
+
If set to `false`, the clone is hidden by having it's CSS `display` property set to `none`.
509
+
By default, this option is `true`, meaning Sortable will remove the cloned element from the DOM when it is supposed to be hidden.
473
510
474
511
475
512
---
476
513
477
514
515
+
#### `emptyInsertThreshold` option
516
+
The distance (in pixels) the mouse must be from an empty sortable while dragging for the drag element to be inserted into that sortable. Defaults to `5`. Set to `0` to disable this feature.
- to:`HTMLElement` — list, in which moved element.
524
+
- to:`HTMLElement` — list, in which moved element
481
525
- from:`HTMLElement` — previous list
482
526
- item:`HTMLElement` — dragged element
483
527
- clone:`HTMLElement`
@@ -489,9 +533,10 @@ If set to `true`, the dragover event will bubble to parent Sortables. Useful for
489
533
- to:`HTMLElement`
490
534
- from:`HTMLElement`
491
535
- dragged:`HTMLElement`
492
-
- draggedRect:` TextRectangle`
536
+
- draggedRect:`DOMRect`
493
537
- related:`HTMLElement` — element on which have guided
494
-
- relatedRect:` TextRectangle`
538
+
- relatedRect:`DOMRect`
539
+
- willInsertAfter:`Boolean` — `true` if will element be inserted after target (or `false` if before)
495
540
496
541
497
542
---
@@ -638,7 +683,7 @@ Link to the active instance.
638
683
* closest(el`:HTMLElement`, selector`:String`[, ctx`:HTMLElement`])`:HTMLElement|Null` — for each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree
639
684
* clone(el`:HTMLElement`)`:HTMLElement` — create a deep copy of the set of matched elements
640
685
* toggleClass(el`:HTMLElement`, name`:String`, state`:Boolean`) — add or remove one classes from each element
641
-
* detectDirection(el`:HTMLElement`)`:String` — automatically detect the direction of the element as either `'vertical'` or `'horizontal'`
686
+
* detectDirection(el`:HTMLElement`)`:String` — automatically detect the [direction](https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#direction) of the element as either `'vertical'` or `'horizontal'`
0 commit comments