diff --git a/js/src/modal.js b/js/src/modal.js index 1b8363c01..c06374d74 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -462,7 +462,7 @@ class Modal extends BaseComponent { // Adjust fixed content padding SelectorEngine.find(SELECTOR_FIXED_CONTENT) .forEach(element => { - if (window.innerWidth > element.clientWidth + this._scrollbarWidth) { + if (this._isShorterThanWindow(element)) { return } @@ -475,7 +475,7 @@ class Modal extends BaseComponent { // Adjust sticky content margin SelectorEngine.find(SELECTOR_STICKY_CONTENT) .forEach(element => { - if (window.innerWidth > element.clientWidth + this._scrollbarWidth) { + if (this._isShorterThanWindow(element)) { return } @@ -536,6 +536,10 @@ class Modal extends BaseComponent { return scrollbarWidth } + _isShorterThanWindow(element) { + return window.innerWidth > element.clientWidth + this._scrollbarWidth + } + // Static static jQueryInterface(config, relatedTarget) {