fix: don't initialize the overlay scrollbar if there is a native one

This commit is contained in:
saicaca 2024-01-22 12:01:06 +08:00
parent 4316654a98
commit 31bb0d576e
1 changed files with 11 additions and 3 deletions

View File

@ -279,13 +279,21 @@ function setBannerHeight() {
} }
function initCustomScrollbar() { function initCustomScrollbar() {
OverlayScrollbars(document.querySelector('body'), { OverlayScrollbars(
// docs say that a initialization to the body element would affect native functionality like window.scrollTo
// but just leave it here for now
{
target: document.querySelector('body'),
cancel: {
nativeScrollbarsOverlaid: true, // don't initialize the overlay scrollbar if there is a native one
}
}, {
scrollbars: { scrollbars: {
theme: 'scrollbar-base scrollbar-auto py-1', theme: 'scrollbar-base scrollbar-auto py-1',
autoHide: 'move', autoHide: 'move',
autoHideDelay: 500, autoHideDelay: 500,
autoHideSuspend: false autoHideSuspend: false,
} },
}); });
document.querySelectorAll('pre').forEach((ele) => { document.querySelectorAll('pre').forEach((ele) => {
OverlayScrollbars(ele, { OverlayScrollbars(ele, {