Browse Source

#1880 Fixes modal showing while another hiding unsucessfully attaches callback to 'hide others'. Dimmer no longer hides between modals appearances with allowMultiple

pull/1785/merge
jlukic 9 years ago
parent
commit
aac5321d47
2 changed files with 16 additions and 11 deletions
  1. 1
      RELEASE-NOTES.md
  2. 26
      src/definitions/modules/modal.js

1
RELEASE-NOTES.md

@ -9,6 +9,7 @@
- **Form** - `<select>` now receive error formatting on `form error` **Thanks @davialexandre**
- **Transition** - Added more reasonable default durations for each animation
- **Loader** - `inline loader` now has a `centered` variation
- **Modal** - Modal no longer hides and reshows dimmer when opening a modal with another modal open with `exclusive: true`
- **Popup** - Added `exclusive` parameter to automatically close other popups on open
- **Transition** - Added `toggle` behavior and docs for `show` and `hide`
- **Transition** - transition now has `stop`, `stop all`, and `clear queue` for removing transitions, (undocumented method `stop`, and `start` renamed to `enable` and `disable`)

26
src/definitions/modules/modal.js

@ -302,7 +302,7 @@ $.fn.modal = function(parameters) {
module.set.type();
module.set.clickaway();
if( !settings.allowMultiple && $otherModals.filter(':visible').length > 0) {
if( !settings.allowMultiple && $otherModals.filter('.' + className.active).length > 0) {
module.debug('Other modals visible, queueing show animation');
module.hideOthers(module.showModal);
}
@ -347,7 +347,7 @@ $.fn.modal = function(parameters) {
}
},
hideModal: function(callback) {
hideModal: function(callback, keepDimmed) {
callback = $.isFunction(callback)
? callback
: function(){}
@ -366,7 +366,7 @@ $.fn.modal = function(parameters) {
duration : settings.duration,
useFailSafe : true,
onStart : function() {
if( !module.othersActive() ) {
if(!module.othersActive() && !keepDimmed) {
module.hideDimmer();
}
module.remove.keyboardShortcuts();
@ -422,30 +422,34 @@ $.fn.modal = function(parameters) {
},
hideAll: function(callback) {
var
$visibleModals = $allModals.filter(':visible')
;
callback = $.isFunction(callback)
? callback
: function(){}
;
if( $allModals.is(':visible') ) {
if( $visibleModals.length > 0 ) {
module.debug('Hiding all visible modals');
module.hideDimmer();
$allModals
.filter(':visible')
.modal('hide modal', callback)
$visibleModals
.modal('hide modal', callback)
;
}
},
hideOthers: function(callback) {
var
$visibleModals = $otherModals.filter(':visible')
;
callback = $.isFunction(callback)
? callback
: function(){}
;
if( $otherModals.is(':visible') ) {
if( $visibleModals.length > 0 ) {
module.debug('Hiding other modals', $otherModals);
$otherModals
.filter(':visible')
.modal('hide modal', callback)
$visibleModals
.modal('hide modal', callback, true)
;
}
},

Loading…
Cancel
Save