From 4dfeaabe9b63772dd72ec1a9d8058dcc07c8c0e2 Mon Sep 17 00:00:00 2001 From: Igor Suleymanov Date: Mon, 3 Aug 2015 16:30:18 +0300 Subject: [PATCH] Allow `onHide` callbacks for dropdown prevent hiding I found out that there is no way to prevent dropdown from being hidden in specific cases, so I thought this might be quite handy. In my scenario, I use an input field with attached `jquery-datepicker` and whenever I want to jump between month in it, the dropdown hides. Therefore I propose to add this small feature. --- src/definitions/modules/dropdown.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 49da61ddd..0980fca35 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -423,11 +423,14 @@ $.fn.dropdown = function(parameters) { ; if( module.is.active() ) { module.debug('Hiding dropdown'); - module.animate.hide(function() { - module.remove.visible(); - callback.call(element); - }); - settings.onHide.call(element); + var hideDropdown = settings.onHide.call(element); + + if (hideDropdown === false) { + module.animate.hide(function() { + module.remove.visible(); + callback.call(element); + }); + } } },