handle: ".my-handle", // Restricts sort start click/touch to the specified element
filter: ".ignor-elements", // Selectors that do not lead to dragging (String or Function)
handle: ".my-handle", // Drag handle selector within list items
filter: ".ignore-elements", // Selectors that do not lead to dragging (String or Function)
draggable: ".item", // Specifies which items inside the element should be sortable
ghostClass: "sortable-ghost",
@ -60,10 +61,27 @@ new Sortable(el, {
});
```
#### handle
To make list items draggable, Sortable disables text selection by the user. That's not always desirable. To allow tesxt selection, define a drag handler, which is an area of every list element that allows it to be dragged around.
```js
new Sortable(el, {
handle: ".my-handle",
});
```
```html
<ul>
<li><spanclass="my-handle">:: </span> list item text one
<li><spanclass="my-handle">:: </span> list item text two
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.