fix(theme): avoid layout shift caused by scrollbar

fixes #1054
pull/1844/head
Em Zhan 2 years ago
parent 4ddb96fe50
commit 5a6a02e6c5

@ -16,7 +16,6 @@ const { hasSidebar } = useSidebar()
id="VPContent"
:class="{
'has-sidebar': hasSidebar,
'is-home': frontmatter.layout === 'home'
}"
>
<slot name="not-found" v-if="page.isNotFound"><NotFound /></slot>
@ -61,15 +60,16 @@ const { hasSidebar } = useSidebar()
width: 100%;
}
.VPContent.is-home {
width: 100%;
max-width: 100%;
}
.VPContent.has-sidebar {
margin: 0;
}
@media (min-width: 768px) {
.VPContent {
width: 100vw;
}
}
@media (min-width: 960px) {
.VPContent {
padding-top: var(--vp-nav-height);

@ -30,6 +30,7 @@ const { hasSidebar } = useSidebar()
@media (min-width: 768px) {
.VPFooter {
width: 100vw;
padding: 32px;
}
}

@ -109,6 +109,10 @@ const classes = computed(() => {
}
@media (min-width: 768px) {
.VPLocalNav {
width: 100vw;
}
.menu {
padding: 0 32px;
}

@ -36,6 +36,12 @@ provide('close-screen', closeScreen)
transition: background-color 0.5s;
}
@media (min-width: 768px) {
.VPNav {
width: 100vw;
}
}
@media (min-width: 960px) {
.VPNav {
position: fixed;

@ -106,8 +106,8 @@ watchPostEffect(async () => {
@media (min-width: 1440px) {
.VPSidebar {
padding-left: max(32px, calc((100% - (var(--vp-layout-max-width) - 64px)) / 2));
width: calc((100% - (var(--vp-layout-max-width) - 64px)) / 2 + var(--vp-sidebar-width) - 32px);
padding-left: max(32px, calc((100vw - (var(--vp-layout-max-width) - 64px)) / 2));
width: calc((100vw - (var(--vp-layout-max-width) - 64px)) / 2 + var(--vp-sidebar-width) - 32px);
}
}

@ -30,6 +30,7 @@ body {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
overflow-x: hidden;
}
main {

Loading…
Cancel
Save