This commit is contained in:
parent
c04ed1760c
commit
cc7e127217
|
@ -27,25 +27,19 @@
|
|||
this.$dragElement = $(option.dragElement)
|
||||
this.$moveElement.css("position", "absolute");
|
||||
this.$dragElement.css("cursor", option.cursor || "move");
|
||||
|
||||
this.$dragElement.on("mousedown", this._mousedown.bind(this));
|
||||
|
||||
if (this.$moveElement.css("left") === "auto") this.$moveElement.css("left", 0);
|
||||
if (this.$dragElement.css("top") === "auto") this.$dragElement.css("top", 0);
|
||||
|
||||
this._docMove = this._mousemove.bind(this);
|
||||
this._docUp = this._mouseup.bind(this);
|
||||
|
||||
this.stopped = false;
|
||||
},
|
||||
_mousedown: function (evt) {
|
||||
|
||||
_mousedown: function (evt) {
|
||||
this.currentPosition.x = evt.pageX;
|
||||
this.currentPosition.y = evt.pageY;
|
||||
$(document).on("mousemove", this._docMove);
|
||||
$(document).on("mouseup", this._docUp);
|
||||
evt.stopDrag = function () {
|
||||
|
||||
this.stopped = true;
|
||||
}.bind(this);
|
||||
if (this.option.start) {
|
||||
|
@ -68,7 +62,6 @@
|
|||
this.currentPosition.x = evt.pageX;
|
||||
this.currentPosition.y = evt.pageY;
|
||||
evt.preventDefault();
|
||||
|
||||
},
|
||||
_mouseup: function (evt) {
|
||||
$(document).off("mousemove", this._docMove);
|
||||
|
@ -77,7 +70,6 @@
|
|||
this.option.end(evt);
|
||||
}
|
||||
this.stopped = false;
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue