Create a private method to check if elem is shorter
This commit is contained in:
parent
c19d06acbf
commit
ee959189a7
1 changed files with 6 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue