From 93dfd995df66eb1280d69f5017ef7e6af32c5c98 Mon Sep 17 00:00:00 2001 From: Dave Stein Date: Mon, 10 Dec 2012 17:20:11 -0500 Subject: [PATCH] Draggable: Added disabled option --- ui/jquery.ui.draggable.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index a6276c37f..6eaf03036 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -33,7 +33,8 @@ $.widget( "ui.draggable", $.ui.interaction, { appendTo: null, handle: null, helper: false, - exclude: "input,textarea,button,select,option" + exclude: "input,textarea,button,select,option", + disabled: false }, // dragEl: element being dragged (original or helper) @@ -73,6 +74,11 @@ $.widget( "ui.draggable", $.ui.interaction, { _start: function( event, pointerPosition ) { var offset; + + // Stop drag if option says disabled + if ( this.options.disabled === true ) { + return; + } // The actual dragging element, should always be a jQuery object this.dragEl = this.options.helper ?