diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-07-03 14:59:10 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-07-03 14:59:10 +0000 |
commit | 7c5e5d9c5e1e7cb90b33fd9e7faca6b721b633af (patch) | |
tree | 8fa7cb9467cc981c5f6f62ab4e2cfac1770dac41 /ui | |
parent | 069fcab637893d464a397db40780cbcfb4615eaf (diff) | |
download | jquery-ui-7c5e5d9c5e1e7cb90b33fd9e7faca6b721b633af.tar.gz jquery-ui-7c5e5d9c5e1e7cb90b33fd9e7faca6b721b633af.zip |
draggable: revert option now accepts "invalid", "valid" and true as possible options: true always reverts, "invalid" only reverts when not dropped on a possible target, and "valid" does the contrary (implements #2914)
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.draggable.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js index 6dd939b1f..69f92b0d7 100644 --- a/ui/ui.draggable.js +++ b/ui/ui.draggable.js @@ -216,10 +216,11 @@ $.widget("ui.draggable", $.extend($.ui.mouse, { mouseStop: function(e) { //If we are using droppables, inform the manager about the drop + var dropped = false; if ($.ui.ddmanager && !this.options.dropBehaviour) - $.ui.ddmanager.drop(this, e); - - if(this.options.revert) { + var dropped = $.ui.ddmanager.drop(this, e); + + if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true) { var self = this; $(this.helper).animate(this.originalPosition, parseInt(this.options.revert, 10) || 500, function() { self.propagate("stop", e); |