Is there any way to have a jQuery sortable list show a placeholder for where the initial item was when you drag one out to sort?
i.e. when a user goes to move one of the LIs in my list, I want a rectangle outline to show where the one they're dragging came from.
Short version: you can use sortable's start
event handler to reveal the original item, and modify its appearance however you like. E.g.:
$(listOfStuff).sortable({
start: function (e, ui) {
ui.item.show().addClass('original-placeholder');
});
With the above, rather than your original item dissappearing when the user begins to drag, it will maintain its original position, and it will gain the 'original-placeholder'.
What's going on (as far as I can tell):
start
function is run when the user begins to drag.I'm not particularly familiar with the internals, but I'd imagine others may be able to say more about how far one can push this technique.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With