Skip to content

Instantly share code, notes, and snippets.

@kenn
Created November 30, 2012 18:00
Show Gist options
  • Select an option

  • Save kenn/4177396 to your computer and use it in GitHub Desktop.

Select an option

Save kenn/4177396 to your computer and use it in GitHub Desktop.
// Sort rooms by drag and drop
$(document).ready(function(){
$('#sortable_rooms').disableSelection()
$('#sortable_rooms').sortable({
axis: 'y',
dropOnEmpty: false,
items: 'li',
opacity: 0.4,
scroll: true,
update: function(){
$.post('/home/move',
{ rooms: _.map($('#sortable_rooms li'), function(e) { return extractId(e.id) }).join(',') },
function() { $('#sortable_rooms').effect('highlight') }
)
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment