OK, I'm experimenting a bit with RubaXa's Sortable plugin. (Here's a great example page)
var sort = new Sortable($('#items')[0], {
animation: 150,
onUpdate: function(evt/**Event*/){
var item = evt.item;
console.log(evt);
}
});
The Plugin works fine. The thing is how can I get the index at which the element has been dropped? (e.g. from index 2 of the list to index 0)
The event that's passed to
onSort
has the fields you need:oldIndex
andnewIndex
: