-
Notifications
You must be signed in to change notification settings - Fork 436
Closed
Description
Hey Johnny,
Thanks for the rocking plugin. I was trying to order dynamically added elements and it doesn't work. Gives an error - $item is undefined.
Any clue on how can I accomplish this?
Below is my code
$("ul.order_list").sortable({
handle: '.grab',
onDragStart: function ($item, container, _super) {
var offset = $item.offset(),
pointer = container.rootGroup.pointer
adjustment = {
left: pointer.left - offset.left,
top: pointer.top - offset.top
}
_super($item, container)
},
onDrag: function ($item, position) {
$item.css({
left: position.left - adjustment.left,
top: position.top - adjustment.top
})
},
onDrop: function ($item, container, _super) {
$item.removeClass("dragged").removeAttr("style");
$("body").removeClass("dragging");
newOrder = $("ul.order_list").sortable("serialize").get();
postPhotoListOrder(newOrder);
}
});Thanks a lot mate!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels