migrate to new git
This commit is contained in:
21
web/App_Script/sweetalert2-9.10.9/src/utils/scrollbarFix.js
Normal file
21
web/App_Script/sweetalert2-9.10.9/src/utils/scrollbarFix.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as dom from './dom/index.js'
|
||||
|
||||
export const fixScrollbar = () => {
|
||||
// for queues, do not do this more than once
|
||||
if (dom.states.previousBodyPadding !== null) {
|
||||
return
|
||||
}
|
||||
// if the body has overflow
|
||||
if (document.body.scrollHeight > window.innerHeight) {
|
||||
// add padding so the content doesn't shift after removal of scrollbar
|
||||
dom.states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'))
|
||||
document.body.style.paddingRight = `${dom.states.previousBodyPadding + dom.measureScrollbar()}px`
|
||||
}
|
||||
}
|
||||
|
||||
export const undoScrollbar = () => {
|
||||
if (dom.states.previousBodyPadding !== null) {
|
||||
document.body.style.paddingRight = `${dom.states.previousBodyPadding}px`
|
||||
dom.states.previousBodyPadding = null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user