Skip to content

Commit

Permalink
Merge pull request #287 from schorke/master
Browse files Browse the repository at this point in the history
Add "auto" modal fade option
  • Loading branch information
thednp committed May 28, 2019
2 parents 2606969 + 7d09ec6 commit d1e6519
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 211 deletions.
27 changes: 14 additions & 13 deletions dist/bootstrap-native-v4.js
@@ -1,4 +1,4 @@
// Native Javascript for Bootstrap 4 v2.0.26 | © dnp_theme | MIT-License
// Native Javascript for Bootstrap 4 v2.0.27 | © dnp_theme | MIT-License
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD support:
Expand Down Expand Up @@ -319,7 +319,7 @@
arrowLeft && (arrow[style][left] = arrowLeft + 'px');
};

BSN.version = '2.0.26';
BSN.version = '2.0.27';

/* Native Javascript for Bootstrap 4 | Alert
-------------------------------------------*/
Expand Down Expand Up @@ -1020,8 +1020,8 @@
// determine modal, triggering element
btnCheck = element[getAttribute](dataTarget)||element[getAttribute]('href'),
checkModal = queryElement( btnCheck ),
modal = hasClass(element,component) ? element : checkModal;
modal = hasClass(element,component) ? element : checkModal;

if ( hasClass(element, component) ) { element = null; } // modal is now independent of it's triggering element

if ( !modal ) { return; } // invalidate
Expand All @@ -1032,6 +1032,7 @@
this[keyboard] = options[keyboard] === false || modal[getAttribute](dataKeyboard) === 'false' ? false : true;
this[backdrop] = options[backdrop] === staticString || modal[getAttribute](databackdrop) === staticString ? staticString : true;
this[backdrop] = options[backdrop] === false || modal[getAttribute](databackdrop) === 'false' ? false : this[backdrop];
this[animation] = hasClass(modal, 'fade') ? true : false;
this[content] = options[content]; // JavaScript only

// bind, constants, event targets and other vars
Expand Down Expand Up @@ -1082,24 +1083,24 @@
scrollBarWidth = measureScrollbar();
},
createOverlay = function() {
modalOverlay = 1;
modalOverlay = 1;

var newOverlay = DOC[createElement]('div');
overlay = queryElement('.'+modalBackdropString);

if ( overlay === null ) {
newOverlay[setAttribute]('class',modalBackdropString+' fade');
newOverlay[setAttribute]('class', modalBackdropString + (self[animation] ? ' fade' : ''));
overlay = newOverlay;
DOC[body][appendChild](overlay);
}
},
removeOverlay = function() {
overlay = queryElement('.'+modalBackdropString);
if ( overlay && overlay !== null && typeof overlay === 'object' ) {
modalOverlay = 0;
modalOverlay = 0;
DOC[body].removeChild(overlay); overlay = null;
}
bootstrapCustomEvent.call(modal, hiddenEvent, component);
bootstrapCustomEvent.call(modal, hiddenEvent, component);
},
keydownHandlerToggle = function() {
if (hasClass(modal,showClass)) {
Expand Down Expand Up @@ -1133,12 +1134,12 @@
triggerHide = function() {
modal[style].display = '';
element && (setFocus(element));

(function(){
if (!getElementsByClassName(DOC,component+' '+showClass)[0]) {
resetScrollbar();
removeClass(DOC[body],component+'-open');
overlay && hasClass(overlay,'fade') ? (removeClass(overlay,showClass), emulateTransitionEnd(overlay,removeOverlay))
overlay && hasClass(overlay,'fade') ? (removeClass(overlay,showClass), emulateTransitionEnd(overlay,removeOverlay))
: removeOverlay();

resizeHandlerToggle();
Expand Down Expand Up @@ -1193,7 +1194,7 @@

if ( overlay && modalOverlay && !hasClass(overlay,showClass)) {
overlay[offsetWidth]; // force reflow to enable trasition
overlayDelay = getTransitionDurationFromElement(overlay);
overlayDelay = getTransitionDurationFromElement(overlay);
addClass(overlay, showClass);
}

Expand All @@ -1213,7 +1214,7 @@
this.hide = function() {
bootstrapCustomEvent.call(modal, hideEvent, component);
overlay = queryElement('.'+modalBackdropString);
overlayDelay = overlay && getTransitionDurationFromElement(overlay);
overlayDelay = overlay && getTransitionDurationFromElement(overlay);

removeClass(modal,showClass);
modal[setAttribute](ariaHidden, true);
Expand Down
4 changes: 2 additions & 2 deletions dist/bootstrap-native-v4.min.js

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions dist/bootstrap-native.js
@@ -1,4 +1,4 @@
// Native Javascript for Bootstrap 3 v2.0.26 | © dnp_theme | MIT-License
// Native Javascript for Bootstrap 3 v2.0.27 | © dnp_theme | MIT-License
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD support:
Expand Down Expand Up @@ -319,7 +319,7 @@
element.className[indexOf](position) === -1 && (element.className = element.className.replace(tipPositions,position));
};

BSN.version = '2.0.26';
BSN.version = '2.0.27';

/* Native Javascript for Bootstrap 3 | Affix
-------------------------------------------*/
Expand Down Expand Up @@ -1170,8 +1170,8 @@
// determine modal, triggering element
btnCheck = element[getAttribute](dataTarget)||element[getAttribute]('href'),
checkModal = queryElement( btnCheck ),
modal = hasClass(element,component) ? element : checkModal;
modal = hasClass(element,component) ? element : checkModal;

if ( hasClass(element, component) ) { element = null; } // modal is now independent of it's triggering element

if ( !modal ) { return; } // invalidate
Expand All @@ -1182,6 +1182,7 @@
this[keyboard] = options[keyboard] === false || modal[getAttribute](dataKeyboard) === 'false' ? false : true;
this[backdrop] = options[backdrop] === staticString || modal[getAttribute](databackdrop) === staticString ? staticString : true;
this[backdrop] = options[backdrop] === false || modal[getAttribute](databackdrop) === 'false' ? false : this[backdrop];
this[animation] = hasClass(modal, 'fade') ? true : false;
this[content] = options[content]; // JavaScript only

// bind, constants, event targets and other vars
Expand Down Expand Up @@ -1233,12 +1234,12 @@
},
createOverlay = function() {
modalOverlay = 1;

var newOverlay = DOC[createElement]('div');
overlay = queryElement('.'+modalBackdropString);

if ( overlay === null ) {
newOverlay[setAttribute]('class',modalBackdropString+' fade');
newOverlay[setAttribute]('class', modalBackdropString + (self[animation] ? ' fade' : ''));
overlay = newOverlay;
DOC[body][appendChild](overlay);
}
Expand All @@ -1249,7 +1250,7 @@
modalOverlay = 0;
DOC[body].removeChild(overlay); overlay = null;
}
bootstrapCustomEvent.call(modal, hiddenEvent, component);
bootstrapCustomEvent.call(modal, hiddenEvent, component);
},
keydownHandlerToggle = function() {
if (hasClass(modal,inClass)) {
Expand Down Expand Up @@ -1283,12 +1284,12 @@
triggerHide = function() {
modal[style].display = '';
element && (setFocus(element));

(function(){
if (!getElementsByClassName(DOC,component+' '+inClass)[0]) {
resetScrollbar();
removeClass(DOC[body],component+'-open');
overlay && hasClass(overlay,'fade') ? (removeClass(overlay,inClass), emulateTransitionEnd(overlay,removeOverlay))
overlay && hasClass(overlay,'fade') ? (removeClass(overlay,inClass), emulateTransitionEnd(overlay,removeOverlay))
: removeOverlay();

resizeHandlerToggle();
Expand Down
4 changes: 2 additions & 2 deletions dist/bootstrap-native.min.js

Large diffs are not rendered by default.

0 comments on commit d1e6519

Please sign in to comment.