Draggable: Add "updatePosition" option to control if we want to automatically update the position of the draggable. #718

Closed
wants to merge 1 commit into
from
View
12 ui/jquery.ui.draggable.js
@@ -42,7 +42,8 @@ $.widget("ui.draggable", $.ui.mouse, {
snapMode: "both",
snapTolerance: 20,
stack: false,
- zIndex: false
+ zIndex: false,
+ updatePosition: true
},
_create: function() {
@@ -181,9 +182,12 @@ $.widget("ui.draggable", $.ui.mouse, {
}
this.position = ui.position;
}
-
- if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
- if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
+ if (this.options.updatePosition) {
+ if (!this.options.axis || this.options.axis != "y")
+ this.helper[0].style.left = this.position.left + 'px';
+ if (!this.options.axis || this.options.axis != "x")
+ this.helper[0].style.top = this.position.top + 'px';
+ }
if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
return false;