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.