remove scrollbar gutter for Chrome when body scroll is locked
This commit is contained in:
@@ -6,6 +6,7 @@ let refCount = 0
|
|||||||
function incrementRefCount() {
|
function incrementRefCount() {
|
||||||
if (refCount === 0) {
|
if (refCount === 0) {
|
||||||
document.body.style.overflow = 'hidden'
|
document.body.style.overflow = 'hidden'
|
||||||
|
document.documentElement.style.scrollbarGutter = 'auto'
|
||||||
}
|
}
|
||||||
refCount++
|
refCount++
|
||||||
}
|
}
|
||||||
@@ -14,6 +15,7 @@ function decrementRefCount() {
|
|||||||
refCount--
|
refCount--
|
||||||
if (refCount === 0) {
|
if (refCount === 0) {
|
||||||
document.body.style.overflow = ''
|
document.body.style.overflow = ''
|
||||||
|
document.documentElement.style.scrollbarGutter = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user