aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-01-03 04:15:41 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-01-03 04:15:41 +0100
commit72a11d6751f6b66dd292139ff877bc4275953701 (patch)
tree972632849f294e1dce84edc484f9608440173385
parentf7f6d5def4bd571bf4d73ea14079b4a66b1da1a8 (diff)
Implement pure CSS nav menu
-rw-r--r--assets/scss/style.scss16
-rw-r--r--layouts/partials/header.html19
2 files changed, 26 insertions, 9 deletions
diff --git a/assets/scss/style.scss b/assets/scss/style.scss
index 1a0f9a8..32ba2ae 100644
--- a/assets/scss/style.scss
+++ b/assets/scss/style.scss
@@ -293,6 +293,10 @@ table {
cursor: pointer;
}
+#menu-btn-checkbox {
+ display: none;
+}
+
#mobile-menu {
position: fixed;
bottom: 4.8em;
@@ -869,6 +873,18 @@ a.footnote-ref {
display: inline-block;
}
+ label[for=menu-btn-checkbox] {
+ cursor: pointer;
+ }
+
+ #menu-btn-checkbox:not(:checked) ~ #mobile-menu {
+ display: none;
+ }
+
+ #mobile-menu {
+ display: inline-block;
+ }
+
.posts-group {
display: block;
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 473f597..ec776db 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,4 +1,4 @@
- <header id="site-header" class="animated slideInUp">
+ <header id="site-header" class="">
<div class="hdr-wrapper section-inner">
<div class="hdr-left">
<div class="site-branding">
@@ -18,14 +18,15 @@
{{- with .Site.Params.social -}}
<span class="hdr-social hide-in-mobile">{{ partialCached "social-icons.html" . }}</span>
{{- end -}}
- <button id="menu-btn" class="hdr-btn" title="{{i18n "menu"}}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>
+ <label id="menu-btn" for="menu-btn-checkbox">&#8803;</label>
+ <input id="menu-btn-checkbox" type="checkbox"/>
+ <div id="mobile-menu" class="animated fast">
+ <ul>
+ {{- range .Site.Menus.main }}
+ <li><a href="{{ .URL | absLangURL }}">{{ .Name }}</a></li>
+ {{- end }}
+ </ul>
+ </div>
</div>
</div>
</header>
- <div id="mobile-menu" class="animated fast">
- <ul>
- {{- range .Site.Menus.main }}
- <li><a href="{{ .URL | absLangURL }}">{{ .Name }}</a></li>
- {{- end }}
- </ul>
- </div>