SortableJS / Sortable

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
https://sortablejs.github.io/Sortable/
MIT License
29.77k stars 3.7k forks source link

[feature] I don't want an item and a ghost of the item #2403

Closed michaeladamkatz closed 2 months ago

michaeladamkatz commented 2 months ago

I don't know if this is possible with the existing options but I couldn't figure it out. I saw that there's a ghost class option, but I think that's just for modifying the ghost, not for doing away with it?

I am sorting a row of images. When I start dragging an image, what I drag is a ghost of the image. The "real" image itself stays in place until I've dragged far enough that I'm over a new position, at which time the "real" image moves (with an animation if I've chosen).

The thing is, I don't want to drag a ghost and have the real image "follow along". I want to actually drag the real image. When I've dragged it far enough, I want the other items to move, showing the space where my image would go. But I don't want the dragged image to snap to that space until I release the image. (At which point it would animate nicely to the snapped position.)

It seems to me that what I'm describing is the standard behavior that I'm used to across apps, operating system functions, etc.

Does sortablejs always do the "ghost follow-along" thing, or is there an option to show only one copy (i.e., the one "real" item, from the user's point of view) of the item I'm dragging, with a float to the snapped position when I release?

michaeladamkatz commented 2 months ago

I realize I was being dumb about one thing. The "ghost" I'm talking about is the browser thinking I'm dragging the image. But when I disable the browser drag of the image

e.on( "dragstart", function( e ) { e.preventDefault(); } );

it kills the drag of sortablejs also. Anyway, I still don't know how to get the behavior described above, but I'll submit another issue once I try to work around the browser not dragging the image (but still allowing sortable to drag the item).