diff --git a/themes/beautifulhugo/layouts/partials/footer_custom.html b/themes/beautifulhugo/layouts/partials/footer_custom.html index 9238f54a36ecca7e5e24ddb0fe922600fa90c090..d822f92893dbc478051afb14d1e958bb6a0d7b90 100644 --- a/themes/beautifulhugo/layouts/partials/footer_custom.html +++ b/themes/beautifulhugo/layouts/partials/footer_custom.html @@ -13,3 +13,9 @@ function toggleSidebar(item) { } } </script> + +<script> +if ($('#sidebar-focus').length != 0) { + $('#site-sidebar').scrollTop($('#sidebar-focus').position().top - 100); +} +</script> diff --git a/themes/beautifulhugo/layouts/partials/nav.html b/themes/beautifulhugo/layouts/partials/nav.html index 334da1bb3c1204dd23cc70b72d929589c80774db..0c23f802280aa939d2add29e2f5daf32228ce4db 100644 --- a/themes/beautifulhugo/layouts/partials/nav.html +++ b/themes/beautifulhugo/layouts/partials/nav.html @@ -77,9 +77,11 @@ <nav class="sidebar sidebar-hidden" id="site-sidebar"> <ul> + {{ $section := .CurrentSection }} {{ range sort .Site.Sections.ByTitle }} <li class="sidebar-section"> - <a href="{{ .URL | relLangURL }}">{{ .Title }}</a> + <a href="{{ .URL | relLangURL }}" + {{ if .InSection $section }}id="sidebar-focus"{{end}}>{{ .Title }}</a> <div class="sidebar-pages"> <ul> {{ range .Pages }} diff --git a/themes/beautifulhugo/static/css/main.css b/themes/beautifulhugo/static/css/main.css index 93b8e674b0566055c46542417970a1e71bbf49cf..0a6fd2ee3fa7d2919ee2af0d517576c0b99c7129 100644 --- a/themes/beautifulhugo/static/css/main.css +++ b/themes/beautifulhugo/static/css/main.css @@ -835,16 +835,16 @@ div.notices.tip p:first-child:after { left: 0; background-color: #414141; overflow-x: hidden; - transition: 0.5s; + transition: height 0.5s; padding-top: 100px; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; } @media not screen, screen and (max-width: 1450px) { .sidebar-hidden { - width: 0px; + height: 0; visibility: hidden; - transition: width 0.5s, visibility 0s linear 0.5s; + transition: height 0.5s, visibility 0s linear 0.5s; } }