diff options
author | Kris - The Coding Unicorn <47773700+guidemetothemoon@users.noreply.github.com> | 2022-04-30 13:08:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-30 13:08:01 +0300 |
commit | ec5066bdb57e8927150cb9e1b37ad0cedb047716 (patch) | |
tree | 5d93e20ec50cd8516205a2375c1da8882f26ef7c | |
parent | 58ec33aa9e0dc8355535f8d65def9c5e7c15e37f (diff) |
fix: apply active class to submenu items (#350)
Co-authored-by: Alexander Bilz <mail@alexbilz.com>
-rw-r--r-- | layouts/partials/navbar.html | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html index eeb29aa..6dec190 100644 --- a/layouts/partials/navbar.html +++ b/layouts/partials/navbar.html @@ -22,21 +22,23 @@ <li class="nav__list-item"> <div class="optionswitch"> <input class="optionswitch__picker" type="checkbox" id="menuoptionpicker" hidden /> - <label - {{ range .Children }} - {{ if in $current.RelPermalink .URL }} - class="optionswitch__label nav__link--active" - - {{ else }} - class="optionswitch__label" - {{ end }} + {{ $labelClass := "optionswitch__label" }} + {{ range .Children }} + {{ if eq $url .URL }} + {{ $labelClass = "optionswitch__label nav__link--active" }} {{ end }} - for="menuoptionpicker" + + + {{ end }} + + + <label class="{{ $labelClass }}" for="menuoptionpicker" >{{ .Name }} <i class="fa fa-angle-down" aria-hidden="true"></i ></label> + <div class="optionswitch__triangle"></div> <ul class="optionswitch__list"> {{ range .Children }} |