jQuery ui-sortable open original place holder on drag outside of list -


i have sortable vertical single column list. need:

1) open original placeholder element on start when user drags element outside of list. need prevent drop outside of list. possible?

2) possible add or change tolerance option? need setup reordering (for vertical list) when top border of dragging element overlaps bottom border of list elements. managed while dragginf upward when dragginf down sorting work on mouse overlap.

$('#sortable').sortable({     sort: function (event, ui) {         var list = $(this),             w = ui.helper.outerwidth(),             h = ui.helper.outerheight();          list.children().each(function () {             if ($(this).hasclass('ui-sortable-helper') || $(this).hasclass('ui-sortable-placeholder')) {                 return true;             }              var currelementheight = $(this).outerheight(),                 overlap = $(this).position().top + currelementheight - ui.position.top,                 placebefore = ui.position.top > $(this).position().top;              if (overlap > 0 && overlap < currelementheight) {                 if (placebefore)                     $('.ui-sortable-placeholder', list).insertbefore($(this));                 else                     $('.ui-sortable-placeholder', list).insertafter($(this));                 return false;             }              if ($(this).position().left + $(this).outerwidth() < ui.position.left) {                 console.log('out');                 //ui.item.parent().sortable('cancel');             }          });      }, }); 

here experiments on jsfiddle


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -