Sortable: Can the opacity of the ghost element be made configurable?

Created on 26 Oct 2015  路  3Comments  路  Source: SortableJS/Sortable

We don't want the ghost element (the item being dragged) to be opaque.

question

Most helpful comment

@n457 that just makes the ghost dissappear. I think what he asks for is a ghost that has opacity 1

All 3 comments

Alas, but it is controls the browser.

Hi :)
It's probably to late for you, but I hope it will help others :

Sortable.create(document.getElementById('yourList'), {
  setData: function (dataTransfer, dragEl) {
    var fakeGhost = dragEl.cloneNode(true);
    fakeGhost.style.opacity = 0;
    document.body.appendChild(fakeGhost);
    dataTransfer.setDragImage(fakeGhost, 0, 0);
  }
});

Inspired by http://www.kryogenix.org/code/browser/custom-drag-image.html

Thanks for making Sortable.js

@n457 that just makes the ghost dissappear. I think what he asks for is a ghost that has opacity 1

Was this page helpful?
0 / 5 - 0 ratings