Permalink
Browse files

Update ui/jquery.ui.draggable.js

Draggable: Add "updatePosition" option to control if we want to automatically update the position of the draggable.
This is useful for some advanced usage of draggable where you want to update the position yourself in the drag callback.
  • Loading branch information...
Carpetsmoker committed Aug 23, 2012
1 parent 30e1ec4 commit 14ab03445c14b8740121414c50762c818ffa55d5
Showing with 8 additions and 4 deletions.
  1. +8 −4 ui/jquery.ui.draggable.js
View
@@ -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;

0 comments on commit 14ab034

Please sign in to comment.