Skip to content

Commit

Permalink
Added the ability to cancel a modal hide from the onHide callback
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog committed Oct 12, 2015
1 parent 76678c1 commit b06b877
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/definitions/modules/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,10 @@ $.fn.modal = function(parameters) {
: function(){}
;
module.debug('Hiding modal');
settings.onHide.call(element);
if(settings.onHide.call(element, $(this)) === false) {
module.verbose('Hide callback returned false cancelling hide');
return;
}

if( module.is.animating() || module.is.active() ) {
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
Expand Down Expand Up @@ -854,7 +857,7 @@ $.fn.modal.settings = {
onVisible : function(){},

// called before hide animation
onHide : function(){},
onHide : function(){ return true; },

// called after hide animation
onHidden : function(){},
Expand Down

0 comments on commit b06b877

Please sign in to comment.