Fix bug not re-calculating scrollbar width when opening modal.
If opening a modal when a scrollbar is present, closing it, then resizing the window so the scrollbar disappears, then opening the modal again, the content would shift. This fixes the problem by always calculating the scrollbar width every time a modal is opened. Closes #14357.
This commit is contained in:
parent
b4895a0d6d
commit
f25181615e
1 changed files with 2 additions and 2 deletions
|
|
@ -207,8 +207,7 @@
|
|||
}
|
||||
|
||||
Modal.prototype.checkScrollbar = function () {
|
||||
if (document.body.clientWidth >= window.innerWidth) return
|
||||
this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
|
||||
this.scrollbarWidth = this.measureScrollbar()
|
||||
}
|
||||
|
||||
Modal.prototype.setScrollbar = function () {
|
||||
|
|
@ -221,6 +220,7 @@
|
|||
}
|
||||
|
||||
Modal.prototype.measureScrollbar = function () { // thx walsh
|
||||
if (document.body.clientWidth >= window.innerWidth) return 0
|
||||
var scrollDiv = document.createElement('div')
|
||||
scrollDiv.className = 'modal-scrollbar-measure'
|
||||
this.$body.append(scrollDiv)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue