I am writing some code using jQuery and the Interface plugin to allow sorting of a list by drag and drop.
The code is pretty simple and works well enough, but I could do with a slightly more sophisticated drop behaviour. Here's the code so far: $(document).ready (function () { $('.favRow').Draggable ({ revert : true, ghosting : true, autosize : true, containment : 'parent', opacity : 0.75, snapDistance : 10 }); $('.favRow').Droppable ({ accept : 'favRow', tolerance : 'pointer', hoverclass : 'dropTarget', ondrop : function (dropped) { thisElem = $(this); droppedElem = $(dropped); if (thisElem.attr ('id') != droppedElem.attr ('id')) { thisElem.before (dropped); } } }); }); The result is the dragged element is always moved to before the element it is dropped on. What I need is for the element to appear either before or after the element it is dropped on depending on whether the dragged element is dropped before or after the half way point of the element it is dropped on. Is this possible? If so, how do I go about doing it?