Draggable: Added disabled option

This commit is contained in:
Dave Stein 2012-12-10 17:20:11 -05:00
parent 94e475ba2d
commit 93dfd995df

View File

@ -33,7 +33,8 @@ $.widget( "ui.draggable", $.ui.interaction, {
appendTo: null, appendTo: null,
handle: null, handle: null,
helper: false, helper: false,
exclude: "input,textarea,button,select,option" exclude: "input,textarea,button,select,option",
disabled: false
}, },
// dragEl: element being dragged (original or helper) // dragEl: element being dragged (original or helper)
@ -74,6 +75,11 @@ $.widget( "ui.draggable", $.ui.interaction, {
_start: function( event, pointerPosition ) { _start: function( event, pointerPosition ) {
var offset; var offset;
// Stop drag if option says disabled
if ( this.options.disabled === true ) {
return;
}
// The actual dragging element, should always be a jQuery object // The actual dragging element, should always be a jQuery object
this.dragEl = this.options.helper ? this.dragEl = this.options.helper ?
this._createHelper( pointerPosition ) : this._createHelper( pointerPosition ) :