Browse Source

Merge pull request #3396 from mdehoog/model-closable-fix

[Modal] Support modification of 'closable' setting while modal is open
pull/5282/merge
Jack Lukic 7 years ago
committed by GitHub
parent
commit
c2d19b0ea6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 18 deletions
  1. 37
      src/definitions/modules/modal.js

37
src/definitions/modules/modal.js

@ -247,16 +247,21 @@ $.fn.modal = function(parameters) {
isInDOM = $.contains(document.documentElement, event.target) isInDOM = $.contains(document.documentElement, event.target)
; ;
if(!isInModal && isInDOM) { if(!isInModal && isInDOM) {
module.debug('Dimmer clicked, hiding all modals');
if( module.is.active() ) {
module.remove.clickaway();
if(settings.allowMultiple) {
module.hide();
}
else {
module.hideAll();
if(settings.closable) {
module.debug('Dimmer clicked, hiding all modals');
if( module.is.active() ) {
module.remove.clickaway();
if(settings.allowMultiple) {
module.hide();
}
else {
module.hideAll();
}
} }
} }
else {
module.debug('Dimmer clicked, but closable is set to false');
}
} }
}, },
debounce: function(method, delay) { debounce: function(method, delay) {
@ -512,11 +517,9 @@ $.fn.modal = function(parameters) {
$module.removeClass(className.active); $module.removeClass(className.active);
}, },
clickaway: function() { clickaway: function() {
if(settings.closable) {
$dimmer
.off('click' + elementEventNamespace)
;
}
$dimmer
.off('click' + elementNamespace)
;
}, },
bodyStyle: function() { bodyStyle: function() {
if($body.attr('style') === '') { if($body.attr('style') === '') {
@ -614,11 +617,9 @@ $.fn.modal = function(parameters) {
} }
}, },
clickaway: function() { clickaway: function() {
if(settings.closable) {
$dimmer
.on('click' + elementEventNamespace, module.event.click)
;
}
$dimmer
.on('click' + elementNamespace, module.event.click)
;
}, },
dimmerSettings: function() { dimmerSettings: function() {
if($.fn.dimmer === undefined) { if($.fn.dimmer === undefined) {

Loading…
Cancel
Save