Shenya
Shenya

Reputation: 344

What do I have to change so that dragging is only possible over a certain area / handle?

I have a list of two droppable boxes where the items can be moved from one box to the other. Now I would like to make it moveable via a handle area. What do I need to change so that dragging is only possible over a certain area - handle (e.g. the rest selectable text)?

  document.addEventListener('dragstart', e => {
  if (e.target.classList.contains('draggable')) {
    dragging = e.target;
    dragging.classList.add('dragging');
    cloned = dragging.cloneNode(true);
  }
});

fiddle

screenshot

Upvotes: 0

Views: 61

Answers (0)

Related Questions