how can I make the elements in a jQuery UI sortable container be freely draggable?
Basically, I want to be able to freely drag items in a container and leave them at whatever position I desire.. However, if there are two items touching each other, dragging the one on 开发者_开发百科the right towards the one on the left should cause the two to swap positions (hence sortability)...
However, if I do:
container.sortable({axis: 'x'});
item_1.draggable({axis: 'x'});
item_2.draggable({axis: 'x'});
container.append(item_1);
container.append(item_2);
then they are not sortable, just draggable... How can I accomplish this?
Have you tried using the refresh
method?
Refresh the sortable items. Custom trigger the reloading of all sortable items, causing new items to be recognized.
This should be called after you append the new elements.
精彩评论