Skip to content

Commit

Permalink
fix: apply active class to submenu items (#350)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Bilz <mail@alexbilz.com>
  • Loading branch information
guidemetothemoon and lxndrblz committed Apr 30, 2022
1 parent 58ec33a commit ec5066b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit ec5066b

Please sign in to comment.