mirror of
https://github.com/wavetermdev/docusaurus-og.git
synced 2026-08-05 13:46:35 -07:00
fix broken scroll on mobile
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
}
|
||||
|
||||
:root {
|
||||
&,
|
||||
body {
|
||||
overflow-x: hidden !important;
|
||||
}
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
background: none;
|
||||
}
|
||||
|
||||
:root {
|
||||
}
|
||||
|
||||
@include utils.responsive('lg', 'down') {
|
||||
.navbar {
|
||||
background: var(--ifm-background-surface-color);
|
||||
}
|
||||
}
|
||||
|
||||
.overflow-hidden {
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
import React from 'react'
|
||||
import { useNavbarMobileSidebar } from '@docusaurus/theme-common/internal'
|
||||
import type { WrapperProps } from '@docusaurus/types'
|
||||
import Navbar from '@theme-original/Navbar'
|
||||
import type NavbarType from '@theme/Navbar'
|
||||
import type { WrapperProps } from '@docusaurus/types'
|
||||
import React, { useEffect } from 'react'
|
||||
import './index.scss'
|
||||
|
||||
type Props = WrapperProps<typeof NavbarType>
|
||||
|
||||
export default function NavbarWrapper(props: Props): JSX.Element {
|
||||
const mobileSidebar = useNavbarMobileSidebar()
|
||||
|
||||
useEffect(() => {
|
||||
if (mobileSidebar.shown) {
|
||||
document
|
||||
.querySelector('#__docusaurus')
|
||||
?.classList?.add?.('overflow-hidden')
|
||||
} else {
|
||||
document
|
||||
.querySelector('#__docusaurus')
|
||||
?.classList?.remove?.('overflow-hidden')
|
||||
}
|
||||
}, [mobileSidebar.shown])
|
||||
|
||||
return (
|
||||
<>
|
||||
<Navbar {...props} />
|
||||
|
||||
Reference in New Issue
Block a user