aboutsummaryrefslogtreecommitdiffstats
path: root/library/Sortable/plugins/Swap/README.md
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-08-03 07:12:35 +0000
committerMario <mario@mariovavti.com>2021-08-03 07:12:35 +0000
commitcddc0217724f1a7661014d50e4c940e623a0c2dc (patch)
treef24595d659adbb7d1e5d2e8e6dcd829b093887bb /library/Sortable/plugins/Swap/README.md
parent571bae9d1c07bb08270163a314c91c138b42e62f (diff)
downloadvolse-hubzilla-cddc0217724f1a7661014d50e4c940e623a0c2dc.tar.gz
volse-hubzilla-cddc0217724f1a7661014d50e4c940e623a0c2dc.tar.bz2
volse-hubzilla-cddc0217724f1a7661014d50e4c940e623a0c2dc.zip
Apps drag and drop feature
Diffstat (limited to 'library/Sortable/plugins/Swap/README.md')
-rw-r--r--library/Sortable/plugins/Swap/README.md55
1 files changed, 55 insertions, 0 deletions
diff --git a/library/Sortable/plugins/Swap/README.md b/library/Sortable/plugins/Swap/README.md
new file mode 100644
index 000000000..7c6e3994a
--- /dev/null
+++ b/library/Sortable/plugins/Swap/README.md
@@ -0,0 +1,55 @@
+## Swap Plugin
+This plugin modifies the behaviour of Sortable to allow for items to be swapped with eachother rather than sorted. Once dragging starts, the user can drag over other items and there will be no change in the elements. However, the item that the user drops on will be swapped with the originally dragged item.
+
+Demo: https://jsbin.com/yejehog/edit?html,js,output
+
+
+---
+
+
+### Mounting
+```js
+import { Sortable, Swap } from 'sortablejs/modular/sortable.core.esm';
+
+Sortable.mount(new Swap());
+```
+
+
+---
+
+
+### Options
+
+```js
+new Sortable(el, {
+ swap: true, // Enable swap mode
+ swapClass: "sortable-swap-highlight" // Class name for swap item (if swap mode is enabled)
+});
+```
+
+
+---
+
+
+#### `swapClass` option
+Class name for the item to be swapped with, if swap mode is enabled. Defaults to `sortable-swap-highlight`.
+
+```css
+.highlighted {
+ background-color: #9AB6F1;
+}
+```
+
+```js
+Sortable.create(list, {
+ swap: true,
+ swapClass: "highlighted"
+});
+```
+
+
+---
+
+
+### Event Properties
+ - swapItem:`HTMLElement|undefined` — The element that the dragged element was swapped with