Skip to content
Discussion options

You must be logged in to vote

To hide the original item being moved so that only the dragged preview (or drag clone) is visible during transit between linked lists, you can configure Sortable's built-in CSS class hooks:

Solution:

When SortableJS begins a drag, it applies ghostClass to the placeholder left in the original list and chosenClass to the selected item.

import Sortable from 'sortablejs';

const options = {
  group: 'shared-data-list',
  animation: 150,
  ghostClass: 'sortable-hidden-ghost',
  chosenClass: 'sortable-hidden-chosen',
  forceFallback: true, // Optional: ensures consistent preview rendering
  fallbackClass: 'sortable-drag-preview'
};

new Sortable(document.getElementById('list-left'), options);
new 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@codetakki
Comment options

@sumit-2007-git
Comment options

Answer selected by codetakki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants