I am trying to get JQuery Sortable to work but I have run into a slight usability problem.
The list that I am trying to sort is quite large (about 200 items). If the
I think that you can consider handling scrolling external to sortable. I suggest to use timer and 'out' event of sortable.
Here is piece of code based on jQueryUI demo page, you can use it as start point, if want to go this way:
$(function() {
var scroll = '';
var $scrollable = $("#sortable");
function scrolling(){
if (scroll == 'up') {
$scrollable.scrollTop($scrollable.scrollTop()-20);
setTimeout(scrolling,50);
}
else if (scroll == 'down'){
$scrollable.scrollTop($scrollable.scrollTop()+20);
setTimeout(scrolling,50);
}
}
$( "#sortable" ).sortable({
scroll:false,
out: function( event, ui ) {
if (!ui.helper) return;
if (ui.offset.top>0) {
scroll='down';
} else {
scroll='up';
}
scrolling();
},
over: function( event, ui ) {
scroll='';
},
deactivate:function( event, ui ) {
scroll='';
}
});
$( "#sortable").disableSelection();
});
Here is also working example: JSBIN
sorry
I did not lock example code and was destroyed incidentally. Now it's back to work.