Bootstrap mode box to implement relative positioning drag-and-drop, bootstrap Mode
1. Normal drag and drop operations are implemented by absolute positioning absolute, but the bootstrap modal box uses relative. For the convenience of unified change, the drag and drop effect is implemented based on relative positioning.
$ (". Modal. modal-header "). mousedown (function (e) {var isDrag = false; // you can drag var ev = e | window. event; var ol = $ (this ). offset (). left; // The leftmost distance of the box from the leftmost distance of the window var ot = $ (this ). offset (). top; var l = (this).parent().css ("left"); var t = (this).parent().css ("top"); deltaX = ev. pageX-parseInt (l); // The leftmost distance from the mouse to the box. deltaY = ev. pageY-parseInt (t); isDrag = true; var _ this = $ (this ). parent (); $ (document ). mousemove (function (e) {var ev = e | window. event; if (isDrag) {moveL = ev. pageX-deltaX; moveT = ev. pageY-deltaY; _this.css ({"left": moveL, "top": moveT}) ;}); $ (document ). mouseup (function () {isDrag = false ;});});
Of course, if you don't have a limit, you can take it off if you want to. Oh no, it's drag, drag, or drag. It's not what you think. Okay, it's what you think.
However, I found that there were still some problems after my judgment, and the problem was not solved yet. I will try again later.