Skip to content

Instantly share code, notes, and snippets.

@yoren
Forked from anonymous/index.html
Created October 24, 2013 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoren/7141199 to your computer and use it in GitHub Desktop.
Save yoren/7141199 to your computer and use it in GitHub Desktop.
A quick demo showing how to capture the order of connected sortable lists.
<ul id="image-list1" class="sortable-list">
<li id="a">A</li>
<li id="b">B</li>
<li id="c">C</li>
</ul>
<ul id="image-list2" class="sortable-list">
<li id="1">1</li>
<li id="2">2</li>
<li id="3">3</li>
</ul>
$('.sortable-list').sortable({
connectWith: '.sortable-list',
update: function(event, ui) {
var changedList = this.id;
var order = $(this).sortable('toArray');
var positions = order.join(';');
console.log({
id: changedList,
positions: positions
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment