Skip to content

Commit e5a4f91

Browse files
authored
Fix scroll-margin-top (#678)
1 parent 7b20ec8 commit e5a4f91

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Elastic.Markdown/Assets/styles.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
--outline-offset: 5;
2020
--header-height: calc(var(--spacing) * 21);
2121
--banner-height: calc(var(--spacing) * 9);
22-
--offset-height: calc(var(--header-height) + var(--banner-height));
22+
--offset-top: calc(var(--header-height) + var(--banner-height));
2323
}
2424

2525
/*#default-search::-webkit-search-cancel-button {*/
@@ -83,8 +83,8 @@
8383

8484
.sidebar {
8585
.sidebar-nav {
86-
@apply sticky top-(--offset-height) z-30 overflow-y-auto;
87-
max-height: calc(100vh - var(--offset-height));
86+
@apply sticky top-(--offset-top) z-30 overflow-y-auto;
87+
max-height: calc(100vh - var(--offset-top));
8888
scrollbar-gutter: stable;
8989
}
9090

@@ -130,7 +130,7 @@
130130
}
131131

132132
* {
133-
scroll-margin-top: calc(var(--spacing) * 26);
133+
scroll-margin-top: calc(var(--offset-top) + var(--spacing) * 6);
134134
}
135135

136136

src/Elastic.Markdown/Slices/Layout/_PagesNav.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@inherits RazorSlice<LayoutViewModel>
2-
<aside class="sidebar bg-white fixed lg:sticky shadow-2xl lg:shadow-none left-[100%] group-has-[#pages-nav-hamburger:checked]/body:left-0 bottom-0 lg:left-auto pl-6 lg:pl-0 top-[calc(var(--offset-height)+1px)] order-1 w-[80%] lg:w-70 xl:w-80 shrink-0 border-r-1 border-r-grey-20 z-40 lg:z-auto">
2+
<aside class="sidebar bg-white fixed lg:sticky shadow-2xl lg:shadow-none left-[100%] group-has-[#pages-nav-hamburger:checked]/body:left-0 bottom-0 lg:left-auto pl-6 lg:pl-0 top-[calc(var(--offset-top)+1px)] order-1 w-[80%] lg:w-70 xl:w-80 shrink-0 border-r-1 border-r-grey-20 z-40 lg:z-auto">
33
<nav
44
id="pages-nav"
55
class="sidebar-nav pr-6"

src/Elastic.Markdown/Slices/Layout/_PrimaryNav.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@inherits RazorSlice<PrimaryNavViewModel>
22
<div class="grow xl:hidden"></div>
3-
<nav class="hidden group-has-[#primary-nav-hamburger:checked]/header:block z-40 overflow-y-scroll xl:overflow-y-visible lg:p-6 pb-12 xl:p-0 fixed xl:static top-[calc(var(--offset-height)+1px)] left-0 right-0 bottom-0 xl:block grow bg-white" id="primary-nav">
3+
<nav class="hidden group-has-[#primary-nav-hamburger:checked]/header:block z-40 overflow-y-scroll xl:overflow-y-visible lg:p-6 pb-12 xl:p-0 fixed xl:static top-[calc(var(--offset-top)+1px)] left-0 right-0 bottom-0 xl:block grow bg-white" id="primary-nav">
44
<div class="container xl:w-full mx-auto xl:mx-0">
55
<ul class="flex flex-col xl:flex-row xl:items-center justify-start xl:h-full text-ink font-sans xl:gap-6">
66
@foreach (var navItem in Model.Items)

0 commit comments

Comments
 (0)