Rebuild the mobile menu to depend less on javascript.
This commit is contained in:
parent
3c444048f3
commit
d3761ce353
2 changed files with 166 additions and 132 deletions
|
|
@ -1,5 +1,27 @@
|
|||
<div class="mobile-nav-wrapper hidden" dir="ltr">
|
||||
<div class="mobile-nav-cover"></div>
|
||||
<a href="#navigation" class="mobile-nav-toggle" aria-haspopup="true" role="button">{{ i18n "menu_mobile" }}</a>
|
||||
<div class="mobile-nav-sheet"></div>
|
||||
<div class="mobile-nav" dir="ltr">
|
||||
<div class="mobile-nav__cover"></div>
|
||||
<a href="#navigation" class="mobile-nav__toggle" aria-haspopup="true" role="button">{{ i18n "menu_mobile" }}</a>
|
||||
<div class="mobile-nav__sheet">
|
||||
<div class="mobile-nav__region">
|
||||
{{ if .Site.IsMultiLingual }}{{ partial "language-selector.html" . }}{{ end }}
|
||||
{{ if $.Param "search" }}{{ partialCached "search.html" . }}{{ end }}
|
||||
</div>
|
||||
{{ $home := relLangURL "/" }}
|
||||
{{ $currentSection := .Section }}
|
||||
{{ $currentID := .UniqueID }}
|
||||
<nav class="mobile-nav__main-menu" role="navigation">
|
||||
<h2 class="visually-hidden">{{ i18n "menu_title" }}</h2>
|
||||
<ul class="mobile-nav__navbar">
|
||||
<li><a class="{{ if .IsHome }}active{{ end }}" href="{{ $home }}">{{ i18n "menu_home" }}</a></li>
|
||||
{{ range where .Site.Pages "Section" "" -}}
|
||||
{{ if ne .RelPermalink (string $home) -}}
|
||||
<li><a class="{{ if eq $currentID .UniqueID }}active{{ end }}" href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ range $.Site.Home.Sections -}}
|
||||
<li><a class="{{ if eq $currentSection .Section }}active{{ end }}" href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||
{{ end -}}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,17 @@
|
|||
{{ $main_options := (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "includePaths" (slice "assets/lib/typey/stylesheets")) -}}
|
||||
{{ $mobile_options := (dict "targetPath" "css/mobile.css" "outputStyle" "compressed" "includePaths" (slice "assets/lib/typey/stylesheets")) -}}
|
||||
{{ $print_options := (dict "targetPath" "css/print.css" "outputStyle" "compressed" "includePaths" (slice "assets/lib/typey/stylesheets")) -}}
|
||||
{{ $main_style := resources.Get "sass/styles.scss" | toCSS $main_options | fingerprint -}}
|
||||
{{ $mobile_style := resources.Get "sass/mobile.scss" | toCSS $mobile_options | fingerprint -}}
|
||||
{{ $print_style := resources.Get "sass/print.scss" | toCSS $print_options | fingerprint -}}
|
||||
{{ if eq .Hugo.Environment "dev" -}}
|
||||
{{ $main_options = (dict "targetPath" "css/styles.css" "outputStyle" "nested" "enableSourceMap" true "includePaths" (slice "assets/lib/typey/stylesheets")) -}}
|
||||
{{ $mobile_options = (dict "targetPath" "css/mobile.css" "outputStyle" "nested" "enableSourceMap" true "includePaths" (slice "assets/lib/typey/stylesheets")) -}}
|
||||
{{ $print_options = (dict "targetPath" "css/print.css" "outputStyle" "nested" "enableSourceMap" true "includePaths" (slice "assets/lib/typey/stylesheets")) -}}
|
||||
{{ $main_style = resources.Get "sass/styles.scss" | toCSS $main_options -}}
|
||||
{{ $mobile_style := resources.Get "sass/mobile.scss" | toCSS $mobile_options -}}
|
||||
{{ $print_style = resources.Get "sass/print.scss" | toCSS $print_options -}}
|
||||
{{ end -}}
|
||||
{{ if $.Param "mobilemenu" }}<link rel="stylesheet" href="{{ $mobile_style.RelPermalink }}" media="screen">{{ end -}}
|
||||
<link rel="stylesheet" href="{{ $main_style.RelPermalink }}">
|
||||
<link rel="stylesheet" href="{{ $print_style.RelPermalink }}" media="print">
|
||||
|
|
|
|||
Loading…
Reference in a new issue