Resortable - v2.1.5
    Preparing search index...

    Class GhostManager

    GhostManager handles the creation and management of ghost elements during drag operations. The ghost element is a visual clone that follows the cursor during dragging.

    Index

    Constructors

    • Parameters

      • ghostClass: string = 'sortable-ghost'
      • chosenClass: string = 'sortable-chosen'
      • dragClass: string = 'sortable-drag'

      Returns GhostManager

    Methods

    • Creates a ghost element from the dragged element.

      Parameters

      • draggedElement: HTMLElement

        The element being dragged

      • event: MouseEvent | DragEvent | PointerEvent

        The drag event containing position information

      • Optionaloptions: CreateGhostOptions

        Optional configuration. See CreateGhostOptions. When omitted, the ghost is appended to document.body with no fallback class and zero offset (the pre-PR2 default).

      Returns HTMLElement

      The created ghost element

    • Creates a stacked ghost for multi-item drag. Shows the anchor item with a count badge and stacked shadow effect.

      Parameters

      • anchorElement: HTMLElement
      • itemCount: number
      • event: MouseEvent | DragEvent | PointerEvent
      • Optionaloptions: CreateGhostOptions

      Returns HTMLElement

    • Creates a placeholder element to show where the item will be dropped.

      The placeholder is a semi-transparent CLONE of the dragged element — legacy-SortableJS parity, where the in-list drop indicator is the item itself wearing ghostClass. A bare gray box (the previous behaviour) reads as a rendering glitch next to rich item content like thumbnails.

      Parameters

      • referenceElement: HTMLElement

        Element to base the placeholder on

      • Optionaloptions: { dataIdAttr?: string }

        dataIdAttr names the identity attribute to strip

      Returns HTMLElement

      The created placeholder element

    • Updates the position of the ghost element

      Parameters

      • clientX: number

        Mouse X position

      • clientY: number

        Mouse Y position

      Returns void

    • Shows or updates the placeholder at the specified position

      Parameters

      • container: HTMLElement

        The container element

      • beforeElement: null | HTMLElement

        Insert placeholder before this element (null = append)

      Returns void

    • Removes the ghost element and cleans up

      Parameters

      • OptionaldraggedElement: HTMLElement

        Original dragged element to remove classes from

      Returns void

    • Cleans up all ghost-related elements

      Parameters

      • OptionaldraggedElement: HTMLElement

        Original dragged element to remove classes from

      Returns void

    • Gets the current placeholder element

      Returns null | HTMLElement