navigation menu highlight selected item
This commit is contained in:
parent
9e657da94a
commit
34f140dbb6
@ -70,6 +70,11 @@
|
|||||||
.spacer {
|
.spacer {
|
||||||
flex-grow: 1 !important;
|
flex-grow: 1 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__active {
|
||||||
|
color: $accent;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu {
|
.menu {
|
||||||
@ -154,4 +159,9 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__active {
|
||||||
|
color: $accent;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
<nav class="navigation-menu">
|
<nav class="navigation-menu">
|
||||||
<ul class="navigation-menu__inner menu--desktop">
|
<ul class="navigation-menu__inner menu--desktop">
|
||||||
|
{{ $currURL := .Permalink }}
|
||||||
{{ if or $.Site.Params.showMenuItems ( eq .Site.Params.showMenuItems 0 ) }}
|
{{ if or $.Site.Params.showMenuItems ( eq .Site.Params.showMenuItems 0 ) }}
|
||||||
{{ range first $.Site.Params.showMenuItems $.Site.Menus.main }}
|
{{ range first $.Site.Params.showMenuItems $.Site.Menus.main }}
|
||||||
{{ if not .HasChildren }}
|
{{ if not .HasChildren }}
|
||||||
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
|
{{ $isCurrURL := eq (absLangURL $currURL) (absLangURL .URL) }}
|
||||||
|
<li {{ if $isCurrURL }} class="navigation-menu__active" {{ end }}>
|
||||||
|
<a href="{{ .URL }}">{{ .Name }}</a>
|
||||||
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if gt (len $.Site.Menus.main) $.Site.Params.showMenuItems }}
|
{{ if gt (len $.Site.Menus.main) $.Site.Params.showMenuItems }}
|
||||||
@ -14,7 +18,10 @@
|
|||||||
<ul class="menu__dropdown">
|
<ul class="menu__dropdown">
|
||||||
{{ range last (sub (len $.Site.Menus.main) $.Site.Params.showMenuItems) $.Site.Menus.main }}
|
{{ range last (sub (len $.Site.Menus.main) $.Site.Params.showMenuItems) $.Site.Menus.main }}
|
||||||
{{ if not .HasChildren }}
|
{{ if not .HasChildren }}
|
||||||
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
|
{{ $isCurrURL := eq (absLangURL $currURL) (absLangURL .URL) }}
|
||||||
|
<li {{ if $isCurrURL }} class="navigation-menu__active" {{ end }}>
|
||||||
|
<a href="{{ .URL }}">{{ .Name }}</a>
|
||||||
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
@ -25,7 +32,10 @@
|
|||||||
{{ else }}
|
{{ else }}
|
||||||
{{ range $.Site.Menus.main }}
|
{{ range $.Site.Menus.main }}
|
||||||
{{ if not .HasChildren }}
|
{{ if not .HasChildren }}
|
||||||
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
|
{{ $isCurrURL := eq (absLangURL $currURL) (absLangURL .URL) }}
|
||||||
|
<li {{ if $isCurrURL }} class="navigation-menu__active" {{ end }}>
|
||||||
|
<a href="{{ .URL }}">{{ .Name }}</a>
|
||||||
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -2,9 +2,13 @@
|
|||||||
<li class="menu__trigger">Menu ▾</li>
|
<li class="menu__trigger">Menu ▾</li>
|
||||||
<li>
|
<li>
|
||||||
<ul class="menu__dropdown">
|
<ul class="menu__dropdown">
|
||||||
|
{{ $currURL := .Permalink }}
|
||||||
{{ range $.Site.Menus.main }}
|
{{ range $.Site.Menus.main }}
|
||||||
{{ if not .HasChildren }}
|
{{ if not .HasChildren }}
|
||||||
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
|
{{ $isCurrURL := eq (absLangURL $currURL) (absLangURL .URL) }}
|
||||||
|
<li {{ if $isCurrURL }} class="menu__active" {{ end }}>
|
||||||
|
<a href="{{ .URL }}">{{ .Name }}</a>
|
||||||
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if and $.Site.Params.showLanguageSelector (len $.Site.Home.AllTranslations) }}
|
{{ if and $.Site.Params.showLanguageSelector (len $.Site.Home.AllTranslations) }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user