The library in use:
https://cdn.jsdelivr.net/npm/@shopify/draggable@1.0.0-beta.8/lib/draggable.bundle.js
Default configuration
The following plugins come with
Draggable by default:
- Announcement - announcing draggable events for a screenreader.
- Focusable - adds tabindex to all draggable and container elements and thus makes them focusable
- Mirror - creates a similar element to the original that will follow the cursor
- Scrollable - scrolls the container while dragging when container edge is reached
Sortable is built on top of Draggable, so it has also all of this.
HTML body content
<ul class="container">
<li class="draggable">1</li>
<li class="draggable">2</li>
<li class="draggable">3</li>
</ul>
<ul class="container">
<li class="draggable">1</li>
<li class="draggable">2</li>
<li class="draggable">3</li>
</ul>
<ul class="container">
<li class="draggable">1</li>
<li class="draggable">2</li>
<li class="draggable">3</li>
</ul>
JavaScript content
var containers = document.querySelectorAll('.container');
var draggable = new window.Draggable.Sortable(containers, {
draggable: '.draggable'
});
How it looks like
See the fiddle for yourself!
No comments:
Post a Comment