en.javascript.info/2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solution.md
Ilya Kantor 5d1037cbd0 minor
2019-08-18 09:44:30 +03:00

308 B

To drag the element we can use position:fixed, it makes coordinates easier to manage. At the end we should switch it back to position:absolute to lay the element into the document.

When coordinates are at window top/bottom, we use window.scrollTo to scroll it.

More details in the code, in comments.