Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add modal fade option #287

Merged
merged 2 commits into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions dist/bootstrap-native-v4.js
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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.

Loading