Here is good solution of sorting elements using jQuery: jQuery UI Sortable, then write order into a database
$('#element').sortable({
axis: 'y',
update: function (event, ui) {
var data = $(this).sortable('serialize');
// POST to server using $.post or $.ajax
$.ajax({
data: data,
type: 'POST',
url: '/your/url/here'
});
}
});
But how change the code to make it mobile friendly? Sorting on the touch screens don't work at all.