Created
October 1, 2019 04:30
-
-
Save cowwoc/9e3045517c55538f057228a7c1629dcf to your computer and use it in GitHub Desktop.
// source https://jsbin.com/notiyoheho
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style id="jsbin-css"> | |
.sortable-ghost { | |
opacity: .5; | |
background: #C8EBFB; | |
} | |
body { | |
padding: 20px; | |
} | |
.list-group-item { | |
cursor: move; | |
} | |
</style> | |
<!-- Latest compiled and minified CSS --> | |
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/> | |
<!-- Latest Sortable --> | |
<script src="http://rawgit.com/rubaxa/Sortable/master/Sortable.js"></script> | |
<!-- HTML --> | |
<ul id="list" class="list-group nested-sortable"> | |
<li class="list-group-item nested-1">item 1 | |
<ul class="list-group nested-sortable"> | |
<li class="list-group-item nested-1">Item 1.1</li> | |
</ul> | |
</li> | |
<li class="list-group-item nested-1">item 2 | |
<ul class="list-group nested-sortable"> | |
</ul> | |
</li> | |
<li class="list-group-item nested-1">item 3 | |
<ul class="list-group nested-sortable"> | |
</ul> | |
</li> | |
<li class="list-group-item nested-1">item 4 | |
<ul class="list-group nested-sortable"> | |
</ul> | |
</li> | |
<li class="list-group-item nested-1">item 5 | |
<ul class="list-group nested-sortable"> | |
</ul> | |
</li> | |
</ul> | |
<script id="jsbin-javascript"> | |
Sortable.create(list, { | |
group: "nested", | |
fallbackOnBody: true, | |
invertSwap: true | |
}); | |
var dropTargets = document.querySelectorAll("ul"); | |
[].forEach.call(dropTargets, function(target) { | |
Sortable.create(target, { | |
group: "nested", | |
fallbackOnBody: true, | |
invertSwap: true | |
}); | |
}); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><\!-- Latest compiled and minified CSS --> | |
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/> | |
<\!-- Latest Sortable --> | |
<script src="//rawgit.com/rubaxa/Sortable/master/Sortable.js"><\/script> | |
<\!-- HTML --> | |
<ul id="list" class="list-group nested-sortable"> | |
<li class="list-group-item nested-1">item 1 | |
<ul class="list-group nested-sortable"> | |
<li class="list-group-item nested-1">Item 1.1</li> | |
</ul> | |
</li> | |
<li class="list-group-item nested-1">item 2 | |
<ul class="list-group nested-sortable"> | |
</ul> | |
</li> | |
<li class="list-group-item nested-1">item 3 | |
<ul class="list-group nested-sortable"> | |
</ul> | |
</li> | |
<li class="list-group-item nested-1">item 4 | |
<ul class="list-group nested-sortable"> | |
</ul> | |
</li> | |
<li class="list-group-item nested-1">item 5 | |
<ul class="list-group nested-sortable"> | |
</ul> | |
</li> | |
</ul> | |
</script> | |
<script id="jsbin-source-css" type="text/css">.sortable-ghost { | |
opacity: .5; | |
background: #C8EBFB; | |
} | |
body { | |
padding: 20px; | |
} | |
.list-group-item { | |
cursor: move; | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">Sortable.create(list, { | |
group: "nested", | |
fallbackOnBody: true, | |
invertSwap: true | |
}); | |
var dropTargets = document.querySelectorAll("ul"); | |
[].forEach.call(dropTargets, function(target) { | |
Sortable.create(target, { | |
group: "nested", | |
fallbackOnBody: true, | |
invertSwap: true | |
}); | |
});</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.sortable-ghost { | |
opacity: .5; | |
background: #C8EBFB; | |
} | |
body { | |
padding: 20px; | |
} | |
.list-group-item { | |
cursor: move; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sortable.create(list, { | |
group: "nested", | |
fallbackOnBody: true, | |
invertSwap: true | |
}); | |
var dropTargets = document.querySelectorAll("ul"); | |
[].forEach.call(dropTargets, function(target) { | |
Sortable.create(target, { | |
group: "nested", | |
fallbackOnBody: true, | |
invertSwap: true | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment