From 69fcfe459678e833cb53de040b9fbc96dd687543 Mon Sep 17 00:00:00 2001 From: vieron Date: Wed, 26 Mar 2014 12:38:06 +0100 Subject: [PATCH] feat(draggable): allow ignore_dragging config option to be a function --- src/jquery.draggable.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index 17919582..3a3660d5 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -14,7 +14,7 @@ limit: true, offset_left: 0, autoscroll: true, - ignore_dragging: ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON'], + ignore_dragging: ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON'], // or function handle: null, container_width: 0, // 0 == auto move_element: true, @@ -387,6 +387,10 @@ return !$(event.target).is(this.options.handle); } + if ($.isFunction(this.options.ignore_dragging)) { + return this.options.ignore_dragging(event); + } + return $(event.target).is(this.options.ignore_dragging.join(', ')); };