Use DOM positioning to simplify dragging code