Browse Source

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.
pull/2769/head
Igor Suleymanov 9 years ago
parent
commit
4dfeaabe9b
1 changed files with 8 additions and 5 deletions
  1. 13
      src/definitions/modules/dropdown.js

13
src/definitions/modules/dropdown.js

@ -423,11 +423,14 @@ $.fn.dropdown = function(parameters) {
; ;
if( module.is.active() ) { if( module.is.active() ) {
module.debug('Hiding dropdown'); 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);
});
}
} }
}, },

Loading…
Cancel
Save