Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
0656d62
Clarify dataIdAttr option docs
owen-m1 Feb 4, 2021
ff4585f
Update package.json: The entry file uses the compiled
lianruhe Apr 13, 2021
a12fb2b
Merge pull request #2028 from lianruhe/master
owen-m1 Apr 21, 2021
77e0481
#1942: Check if ghost is first
owen-m1 May 2, 2021
e83eb7e
#2021: Fix multidrag indicies
owen-m1 May 2, 2021
415506b
README : trick for emptyInsertThreshold
Yopai May 5, 2021
0a1bab7
#2025: Fix reverting with nested sortables
owen-m1 May 8, 2021
d83734a
Add forceAutoScrollFallback option
owen-m1 May 10, 2021
558c633
preformance improvement
owen-m1 Jun 26, 2021
593235d
fix _ghostIsFirst error
owen-m1 Jun 26, 2021
e294ab9
fix deepscan issue
owen-m1 Jun 26, 2021
a1015e2
Update README.md
owen-m1 Jun 27, 2021
7d0c6a0
Update README.md
owen-m1 Jun 27, 2021
101b92e
Merge pull request #2034 from Yopai/patch-1
owen-m1 Jun 27, 2021
4684991
1.14.0
owen-m1 Jul 4, 2021
21f7ede
fix multidrag originalEvent
owen-m1 Aug 9, 2021
3eb3564
fix the drag position problem when existing non draggable elements at…
code4fan Aug 23, 2021
6bf2914
Merge pull request #1 from code4fan/fix-drag-position
code4fan Aug 23, 2021
e5d428a
avoid implicit deselect on outside click
Agnaev Sep 27, 2021
796bb3f
Update README.md
owen-m1 Oct 3, 2021
b8940a9
Merge pull request #2084 from Agnaev/master
owen-m1 Oct 3, 2021
daaefed
Merge pull request #2072 from code4fan/master
owen-m1 Oct 3, 2021
840f9ae
Issue #2093 remove ID from the cloned element prior to adding to the …
vanboom Oct 19, 2021
cf04481
Prevent ignored touches on Android Chrome.
itsjohncs Oct 19, 2021
bf66902
Update package.json
jombLiu Nov 18, 2021
c047ac2
Merge pull request #2104 from jombLiu/patch-1
owen-m1 Dec 2, 2021
8e8a107
Merge pull request #2094 from vanboom/master
owen-m1 Dec 2, 2021
63762d4
Merge pull request #2095 from itsjohncs/prevent-next-click-failure-an…
owen-m1 Mar 19, 2022
632d70b
fix vulnerabilities
owen-m1 Mar 20, 2022
babf6ab
1.15.0
owen-m1 Mar 20, 2022
87fc741
Added conditional statement whether dragged element should be dropped
Apr 6, 2023
7af63fd
Merge pull request #2263 from lucaplays/master
owen-m1 Apr 28, 2023
d3a7f09
docs: remove dollar sign from code blocks
anton-gustafsson Jul 1, 2023
a66e04d
Merge pull request #2291 from anton-gustafsson/patch-1
owen-m1 Jul 2, 2023
c5a8822
#2203: Fix multi drag sort event not firing
owen-m1 Jul 3, 2023
029d0d4
docs: properly capitalize forceAutoScrollFallback option
Gudine Aug 26, 2023
ed02426
Merge pull request #2309 from Gudine/master
owen-m1 Oct 21, 2023
70bf738
#1686: Use parent rect in ghostIsLast & ghostIsFirst
owen-m1 Nov 30, 2023
d12f4b0
Merge branch 'master' of https://github.com/SortableJS/Sortable
owen-m1 Nov 30, 2023
5604d6e
npm audit
owen-m1 Nov 30, 2023
1b7575f
1.15.1
owen-m1 Nov 30, 2023
38e4d87
#2339: Use child containing rect for ghostIsLast & ghostIsFirst
owen-m1 Jan 13, 2024
07708fa
1.15.2
owen-m1 Jan 14, 2024
7f0a463
fix: set the target as the host element when target contains a shadow…
driskull Feb 14, 2024
41ff81f
export expando with utils + include src with npm package
owen-m1 Mar 17, 2024
1e9ad0d
review fixes
driskull Mar 18, 2024
9fab4b9
remove trailing comma for consistency
driskull Mar 18, 2024
e7b4859
Merge pull request #2347 from driskull/master
owen-m1 Mar 22, 2024
2be88e3
Fixes scope bleed on saved input checkboxes
daftspunk Apr 30, 2024
0a88f9a
Syntax error from testing in ES6
daftspunk Apr 30, 2024
dcb8f9e
1.15.3
owen-m1 Sep 1, 2024
f7a645c
fix text selection during fallback drag + improve pointer event support
owen-m1 Nov 22, 2024
afb71dc
npm audit fix
owen-m1 Nov 22, 2024
7fd5baf
#1897: Prevent multi-select of non-draggable and filtered items
owen-m1 Nov 23, 2024
62f0498
1.15.4
owen-m1 Nov 23, 2024
ca13d2c
#2410: clear selection after drag start only with fallback
owen-m1 Nov 27, 2024
a81251f
#2410: Further improve selection handling on drag start
owen-m1 Nov 27, 2024
104d731
1.15.5
owen-m1 Nov 27, 2024
7d7d5d6
restore old fallback selection clearing behaviour
owen-m1 Nov 28, 2024
2217239
#2244: Allow supportPointer to be enabled by default for IOS
owen-m1 Nov 28, 2024
63ecb31
1.15.6
owen-m1 Nov 28, 2024
bd74abb
fix: Sortable crashes browser when event is triggered from within Sha…
marvinscharle Mar 26, 2025
ddd0597
Merge pull request #2431 from marvinscharle/fix/sortable-crashes-shad…
owen-m1 Apr 12, 2025
3696da4
Merge pull request #2369 from daftspunk/patch-1
owen-m1 May 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ Demo: http://sortablejs.github.io/Sortable/

Install with NPM:
```bash
$ npm install sortablejs --save
npm install sortablejs --save
```

Install with Bower:
```bash
$ bower install --save sortablejs
bower install --save sortablejs
```

Import into your project:
Expand Down Expand Up @@ -129,7 +129,7 @@ var sortable = new Sortable(el, {
preventOnFilter: true, // Call `event.preventDefault()` when triggered `filter`
draggable: ".item", // Specifies which items inside the element should be draggable

dataIdAttr: 'data-id',
dataIdAttr: 'data-id', // HTML attribute that is used by the `toArray()` method

ghostClass: "sortable-ghost", // Class name for the drop placeholder
chosenClass: "sortable-chosen", // Class name for the chosen item
Expand Down Expand Up @@ -521,6 +521,19 @@ The distance (in pixels) the mouse must be from an empty sortable while dragging

Demo: https://jsbin.com/becavoj/edit?js,output

An alternative to this option would be to set a padding on your list when it is empty.

For example:
```css
ul:empty {
padding-bottom: 20px;
}
```

Warning: For `:empty` to work, it must have no node inside (even text one).

Demo:
https://jsbin.com/yunakeg/edit?html,css,js,output

---
### Event object ([demo](https://jsbin.com/fogujiv/edit?js,output))
Expand Down Expand Up @@ -549,7 +562,7 @@ Demo: https://jsbin.com/becavoj/edit?js,output
---


### Method
### Methods


##### option(name:`String`[, value:`*`]):`*`
Expand Down Expand Up @@ -726,8 +739,9 @@ Mounts a plugin to Sortable.
* clone(el`:HTMLElement`)`:HTMLElement` — create a deep copy of the set of matched elements
* toggleClass(el`:HTMLElement`, name`:String`, state`:Boolean`) — add or remove one classes from each element
* 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'`


* index(el`:HTMLElement`, selector`:String`)`:Number` — index of the element within its parent for a selected set of elements
* getChild(el`:HTMLElement`, childNum`:Number`, options`:Object`, includeDragEl`:Boolean`):`HTMLElement` — get the draggable element at a given index of draggable elements within a Sortable instance
* expando`:String` — expando property name for internal use, sortableListElement[expando] returns the Sortable instance of that elemenet
---


Expand Down
Loading