vpfjsphp:dragging_and_dropping

html5rocks.com/en/tutorials/dnd/basics/

  1. dragstart
  2. drag
  3. dragenter
  4. dragleave
  5. dragover
  6. drop
  7. dragend
(...)

function move_start(e) {
  e.preventDefault();
}
function move_drag_over(e) {
  e.preventDefault(); // preventing quircky behaviour
}
function moveDrop(e) {
  e.preventDefault();
  which_art.style.left = e.pageX - my_x + 'px';
  which_art.style.top = e.pageY - my_y + 'px';
}

(...)
document.querySelector("body").addEventListener("dragstart", move_start, false);
document.querySelector("body").addEventListener("dragover", move_drag_over, false);
document.querySelector("body").addEventListener("drop", move_drop, false);
vpfjsphp/dragging_and_dropping.txt · Last modified: 2016/03/06 21:32 by leo