Create a private method to check if elem is shorter

This commit is contained in:
Rohit Sharma 2020-12-07 21:44:05 +02:00 committed by XhmikosR
parent c19d06acbf
commit ee959189a7

View file

@ -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) {