mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
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)
This commit is contained in:
parent
069fcab637
commit
7c5e5d9c5e
@ -216,10 +216,11 @@ $.widget("ui.draggable", $.extend($.ui.mouse, {
|
|||||||
mouseStop: function(e) {
|
mouseStop: function(e) {
|
||||||
|
|
||||||
//If we are using droppables, inform the manager about the drop
|
//If we are using droppables, inform the manager about the drop
|
||||||
|
var dropped = false;
|
||||||
if ($.ui.ddmanager && !this.options.dropBehaviour)
|
if ($.ui.ddmanager && !this.options.dropBehaviour)
|
||||||
$.ui.ddmanager.drop(this, e);
|
var dropped = $.ui.ddmanager.drop(this, e);
|
||||||
|
|
||||||
if(this.options.revert) {
|
if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true) {
|
||||||
var self = this;
|
var self = this;
|
||||||
$(this.helper).animate(this.originalPosition, parseInt(this.options.revert, 10) || 500, function() {
|
$(this.helper).animate(this.originalPosition, parseInt(this.options.revert, 10) || 500, function() {
|
||||||
self.propagate("stop", e);
|
self.propagate("stop", e);
|
||||||
|
Loading…
Reference in New Issue
Block a user