1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-08 06:36:33 +02:00

change modal.js to use is-fixed classes to target padding-right

This commit is contained in:
Jacob Thornton
2015-08-15 12:10:24 -07:00
parent db14bac42f
commit c830956d17
6 changed files with 23 additions and 20 deletions

View File

@@ -55,17 +55,18 @@ const Modal = (($) => {
}
const ClassName = {
BACKDROP : 'modal-backdrop',
OPEN : 'modal-open',
FADE : 'fade',
IN : 'in'
SCROLLBAR_MEASURER : 'modal-scrollbar-measure',
BACKDROP : 'modal-backdrop',
OPEN : 'modal-open',
FADE : 'fade',
IN : 'in'
}
const Selector = {
DIALOG : '.modal-dialog',
DATA_TOGGLE : '[data-toggle="modal"]',
DATA_DISMISS : '[data-dismiss="modal"]',
SCROLLBAR_MEASURER : 'modal-scrollbar-measure'
FIXED_CONTENT : '.navbar-fixed-top, .navbar-fixed-bottom, .is-fixed'
}
@@ -414,7 +415,7 @@ const Modal = (($) => {
_setScrollbar() {
let bodyPadding = parseInt(
$(document.body).css('padding-right') || 0,
$(Selector.FIXED_CONTENT).css('padding-right') || 0,
10
)
@@ -432,7 +433,7 @@ const Modal = (($) => {
_getScrollbarWidth() { // thx d.walsh
let scrollDiv = document.createElement('div')
scrollDiv.className = Selector.SCROLLBAR_MEASURER
scrollDiv.className = ClassName.SCROLLBAR_MEASURER
document.body.appendChild(scrollDiv)
let scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
document.body.removeChild(scrollDiv)