Skip to content

Commit 0c582cb

Browse files
author
Aytackydln
committed
separate navigation menu scroll
1 parent 50eb110 commit 0c582cb

5 files changed

Lines changed: 14 additions & 5 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
document.getElementById("active-link")?.scrollIntoView({behavior: "instant", block: "center"});

themes/aurora/assets/scss/_nav.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
$header-height: 64px;
2+
13
nav#main-nav {
24
flex: 1 1 $nav-width;
5+
position: sticky;
6+
top: 64px;
7+
max-height: calc(100vh - 64px);
8+
scrollbar-width: thin;
9+
scrollbar-color: rgba(0,0,0,0.95) transparent;
310
overflow-y: auto;
411
overflow-x: hidden;
512
border-right: 1px solid rgba($text-primary, .15);
@@ -92,7 +99,7 @@ nav#main-nav {
9299
div::after {
93100
top: 8px;
94101
}
95-
102+
96103
div::before {
97104
top: 16px;
98105
}

themes/aurora/layouts/partials/content.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<article class="wide">
22
<!-- Title -->
3-
<h1 class="page-title">{{ default $.Site.Title .Title }}</h1><br/>
3+
<h1 class="page-title" autofocus focusable>{{ default $.Site.Title .Title }}</h1><br/>
44
<span class="date-info italic">Last updated {{ .Lastmod.Format "02.01.2006" }}</span>
55

66
<!-- Actual page content -->

themes/aurora/layouts/partials/nav.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
{{ range $.Site.Sections }}
2020
<div class="nav-section">
2121
<span class="nav-title{{ if eq $cur.Permalink .Permalink }} active{{ end }}">
22-
<a href="{{ .Permalink }}">{{ .Title }}</a>
22+
<a href="{{ .Permalink }}"{{ if eq $cur.Permalink .Permalink }} id="active-link"{{ end }}>{{ .Title }}</a>
2323
</span>
2424
<ul class="nav-list">
2525
{{ range .Pages }}
2626
<li class="{{ if eq $cur.Permalink .Permalink }}active{{ end }}">
27-
<a href="{{ .Permalink }}">{{ .Title }}</a>
27+
<a href="{{ .Permalink }}"{{ if eq $cur.Permalink .Permalink }} id="active-link"{{ end }}>{{ .Title }}</a>
2828
</li>
2929
{{ end }}
3030
</ul>

themes/aurora/layouts/partials/scripts.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
{{ $tabs := resources.Get "js/tabs-script.js" }}
33
{{ $mobile := resources.Get "js/mobile.js" }}
44
{{ $scroll := resources.Get "js/scroll-offset.js" }}
5-
{{ $scripts := slice $externalLink $tabs $mobile $scroll | resources.Concat "app.js" | minify | fingerprint }}
5+
{{ $scrollActiveLink := resources.Get "js/scroll-active-link.js" }}
6+
{{ $scripts := slice $externalLink $tabs $mobile $scroll $scrollActiveLink | resources.Concat "app.js" | minify | fingerprint }}
67
{{ with $scripts }}
78
<script>{{ .Content | safeJS }}</script>
89
{{ end }}

0 commit comments

Comments
 (0)