refactor: adjust css

pull/131/head
Evan You 4 years ago
parent 061ad3ff32
commit f180083219

@ -170,7 +170,8 @@ export function useRoute(): Route {
} }
function scrollTo(el: HTMLElement, hash: string, smooth = false) { function scrollTo(el: HTMLElement, hash: string, smooth = false) {
const pageOffset = document.getElementById('app')!.offsetTop const pageOffset = (document.querySelector('.navbar') as HTMLElement)
.offsetHeight
const target = el.classList.contains('.header-anchor') const target = el.classList.contains('.header-anchor')
? el ? el
: document.querySelector(decodeURIComponent(hash)) : document.querySelector(decodeURIComponent(hash))

@ -36,7 +36,8 @@ export function useActiveSidebarLinks() {
sidebarLinks.some((sidebarLink) => sidebarLink.hash === anchor.hash) sidebarLinks.some((sidebarLink) => sidebarLink.hash === anchor.hash)
) as HTMLAnchorElement[] ) as HTMLAnchorElement[]
const pageOffset = document.getElementById('app')!.offsetTop const pageOffset = (document.querySelector('.navbar') as HTMLElement)
.offsetHeight
const scrollTop = window.scrollY const scrollTop = window.scrollY
const getAnchorTop = (anchor: HTMLAnchorElement): number => const getAnchorTop = (anchor: HTMLAnchorElement): number =>

@ -95,8 +95,8 @@ body {
} }
.theme main { .theme main {
margin-top: var(--header-height); padding-top: var(--header-height);
margin-left: var(--sidebar-width); padding-left: var(--sidebar-width);
} }
@media screen and (min-width: 720px) { @media screen and (min-width: 720px) {

Loading…
Cancel
Save