Question When I was doing business development recently, I encountered a requirement. When the user opened the pop-up window to fill in the content, he wanted to refer to the content in the blank background of the pop-up window, but the pop-up window blocked his sight, so the user wondered whether he could drag the pop-up window arbitrarily. In fact, there is more than this scenario. In many form editors, report designers, online ps, and H5 editors, drag is one of the most basic functions. Next, we will bring a simple experiment and make a simple version of the pop-up window drag and drop function. Analysis As you may have thought, there are only two core methods: Use mousedown , mousemove , mouseup to monitor drag events Dynamically change the left and top positions of the pop-up window according to the current mouse position when dragging Just add some detailed experience processing. Code 1. Constructing the DOM Create a container that occupies a manipulable area Cr