JSFiddle - React, Tailwind, and code Playground
by TJ VanToll
HTML
<link rel="stylesheet" href="http://code.jquery.com/ui/jquery-ui-git.css">
<script src="http://code.jquery.com/ui/jquery-ui-git.js"></script>
<ul id="sortable">
<!-- comment 1 -->
<li>Item 1</li>
<!-- comment 2 -->
<li>Item 2</li>
<!-- comment 3 -->
<li>Item 3</li>
</ul>
CSS
#sortable { list-style: none; padding: 0; }
#sortable li { border: 1px solid black; }
JavaScript
$.widget( "ui.sortable", $.ui.sortable, {
_mouseStart: function() {
this._superApply( arguments );
this.domPosition = { prev: this.currentItem[ 0 ].previousSibling, parent: this.currentItem.parent()[ 0 ] };
}
});
var sortable = $( "#sortable" ).sortable({
helper: "clone",
stop: function( event, ui ) {
sortable.sortable( "cancel" );
}
});