From ba315da43937543e7e68cf56b2dcd6ede342073b Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 15 Jun 2015 13:19:00 -0400 Subject: [PATCH] Fix othersActive check missing some cases with multiple modals --- src/definitions/modules/modal.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/definitions/modules/modal.js b/src/definitions/modules/modal.js index 472166653..673a5f9da 100644 --- a/src/definitions/modules/modal.js +++ b/src/definitions/modules/modal.js @@ -377,7 +377,7 @@ $.fn.modal = function(parameters) { duration : settings.duration, useFailSafe : true, onStart : function() { - if(!module.othersActive() && !keepDimmed) { + if(!module.others.active() && !keepDimmed) { module.hideDimmer(); } module.remove.keyboardShortcuts(); @@ -423,7 +423,7 @@ $.fn.modal = function(parameters) { hideAll: function(callback) { var - $visibleModals = $allModals.filter(':visible') + $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating) ; callback = $.isFunction(callback) ? callback @@ -440,7 +440,7 @@ $.fn.modal = function(parameters) { hideOthers: function(callback) { var - $visibleModals = $otherModals.filter(':visible') + $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating) ; callback = $.isFunction(callback) ? callback @@ -454,10 +454,16 @@ $.fn.modal = function(parameters) { } }, - othersActive: function() { - return ($otherModals.filter('.' + className.active + ', .' + className.animating).length > 0); + others: { + active: function() { + return ($otherModals.filter('.' + className.active).length > 0); + }, + animating: function() { + return ($otherModals.filter('.' + className.animating).length > 0); + } }, + add: { keyboardShortcuts: function() { module.verbose('Adding keyboard shortcuts'); @@ -596,7 +602,7 @@ $.fn.modal = function(parameters) { type: function() { if(module.can.fit()) { module.verbose('Modal fits on screen'); - if(!module.othersActive()) { + if(!module.others.active() && !module.others.animating()) { module.remove.scrolling(); } }