Skip to content
Snippets Groups Projects
Commit 8e9c34ed authored by Martyn Welch's avatar Martyn Welch
Browse files

Align menu to section heading


The site menu is quite long. When we are in a section, scroll the menu to
the relevant section.

This is a bit hacky due to the navbar at the top and the way the theme is
constructed. In order to avoid issues with the scrolling distance being
incorrectly calculated (due to reflow of text as the side bar gets wider)
animate as a drop-down instead of appearing from the side.

Signed-off-by: default avatarMartyn Welch <martyn.welch@collabora.com>
parent 7787e6d9
No related branches found
No related tags found
No related merge requests found
Pipeline #158668 passed
...@@ -13,3 +13,9 @@ function toggleSidebar(item) { ...@@ -13,3 +13,9 @@ function toggleSidebar(item) {
} }
} }
</script> </script>
<script>
if ($('#sidebar-focus').length != 0) {
$('#site-sidebar').scrollTop($('#sidebar-focus').position().top - 100);
}
</script>
...@@ -77,9 +77,14 @@ ...@@ -77,9 +77,14 @@
<nav class="sidebar sidebar-hidden" id="site-sidebar"> <nav class="sidebar sidebar-hidden" id="site-sidebar">
<ul> <ul>
{{ $section := .CurrentSection }}
{{ range sort .Site.Sections.ByTitle }} {{ range sort .Site.Sections.ByTitle }}
<li class="sidebar-section"> <li class="sidebar-section">
{{ if .InSection $section }}
<a href="{{ .URL | relLangURL }}" id="sidebar-focus">{{ .Title }}</a>
{{ else }}
<a href="{{ .URL | relLangURL }}">{{ .Title }}</a> <a href="{{ .URL | relLangURL }}">{{ .Title }}</a>
{{ end }}
<div class="sidebar-pages"> <div class="sidebar-pages">
<ul> <ul>
{{ range .Pages }} {{ range .Pages }}
......
...@@ -835,16 +835,16 @@ div.notices.tip p:first-child:after { ...@@ -835,16 +835,16 @@ div.notices.tip p:first-child:after {
left: 0; left: 0;
background-color: #414141; background-color: #414141;
overflow-x: hidden; overflow-x: hidden;
transition: 0.5s; transition: height 0.5s;
padding-top: 100px; padding-top: 100px;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
} }
@media not screen, screen and (max-width: 1450px) { @media not screen, screen and (max-width: 1450px) {
.sidebar-hidden { .sidebar-hidden {
width: 0px; height: 0%;
visibility: hidden; visibility: hidden;
transition: width 0.5s, visibility 0s linear 0.5s; transition: height 0.5s, visibility 0s linear 0.5s;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment