I remember that in a previous essay on "Drag Layer", I implemented dragging by using a Boolean variable to determine whether an element could be dragged.
After reading some things in the past two days, I found that there is no need to set this Boolean variable;
Implementation process:
When the mouse is pressed, give the document object (of course it can also be other DOM objects) Bind a handler function to the movement event, and also bind a release handler function to when the mouse is raised.