jQuery-UI Draggable and Sortable
12,213
Try using a droppable for your toList:
EDIT: Per comments below:
jQuery(document).ready(function(){
jQuery("#fromList li").draggable('destroy').draggable({
connectToSortable: "#toList",
revert: "invalid",
containment: '#equipCont',
helper: function(e, ui) {
return jQuery(this).clone().css('width', jQuery(this).width());
}
});
jQuery("#toList").droppable('destroy').droppable({
drop: function(e, ui) {
var dragClone = jQuery(ui.draggable).clone();
jQuery("#toList").append(dragClone);
}
});
jQuery("ul, li").disableSelection();
});
Author by
Ryan Mulready
Updated on June 04, 2022Comments
-
Ryan Mulready almost 2 years
So I've been working with this example: http://jqueryui.com/demos/draggable/#sortable and I've accomplished it on my product. However I want to make two significant changes.
I don't want the second list(toList in my example) to be sortable on it's own. I only want it to accept items from the first list(fromList in my example).
When a user drags an item from the first list(fromList) and drops it into the second list(toList) I want that item to be forced to the bottom.
Suggestions? Here is a working fiddle of what I have so far. http://jsfiddle.net/CrtFD/