Browse Source

Fix othersActive check missing some cases with multiple modals

pull/2416/head
jlukic 9 years ago
parent
commit
ba315da439
1 changed files with 12 additions and 6 deletions
  1. 18
      src/definitions/modules/modal.js

18
src/definitions/modules/modal.js

@ -377,7 +377,7 @@ $.fn.modal = function(parameters) {
duration : settings.duration, duration : settings.duration,
useFailSafe : true, useFailSafe : true,
onStart : function() { onStart : function() {
if(!module.othersActive() && !keepDimmed) {
if(!module.others.active() && !keepDimmed) {
module.hideDimmer(); module.hideDimmer();
} }
module.remove.keyboardShortcuts(); module.remove.keyboardShortcuts();
@ -423,7 +423,7 @@ $.fn.modal = function(parameters) {
hideAll: function(callback) { hideAll: function(callback) {
var var
$visibleModals = $allModals.filter(':visible')
$visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating)
; ;
callback = $.isFunction(callback) callback = $.isFunction(callback)
? callback ? callback
@ -440,7 +440,7 @@ $.fn.modal = function(parameters) {
hideOthers: function(callback) { hideOthers: function(callback) {
var var
$visibleModals = $otherModals.filter(':visible')
$visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating)
; ;
callback = $.isFunction(callback) callback = $.isFunction(callback)
? 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: { add: {
keyboardShortcuts: function() { keyboardShortcuts: function() {
module.verbose('Adding keyboard shortcuts'); module.verbose('Adding keyboard shortcuts');
@ -596,7 +602,7 @@ $.fn.modal = function(parameters) {
type: function() { type: function() {
if(module.can.fit()) { if(module.can.fit()) {
module.verbose('Modal fits on screen'); module.verbose('Modal fits on screen');
if(!module.othersActive()) {
if(!module.others.active() && !module.others.animating()) {
module.remove.scrolling(); module.remove.scrolling();
} }
} }

Loading…
Cancel
Save