Skip to content

Commit

Permalink
fix: incorrect display of submenu items when multiple menu dropdowns …
Browse files Browse the repository at this point in the history
…are implemented (#354)

Close #352 

Co-authored-by: Alexander Bilz <mail@alexbilz.com>
  • Loading branch information
guidemetothemoon and lxndrblz authored May 13, 2022
1 parent ec5066b commit 1959fa6
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,30 @@
<nav class="nav">
<ul class="nav__list" id="navMenu">
{{ $url := .RelPermalink }}
{{ $current := . }}
{{ range .Site.Menus.main }}
{{ $active := eq $url .URL }}
{{ if .HasChildren }}
{{ range $menuId, $menuItem := .Site.Menus.main }}
{{ $active := eq $url $menuItem.URL }}
{{ if $menuItem.HasChildren }}
<li class="nav__list-item">
<div class="optionswitch">
<input class="optionswitch__picker" type="checkbox" id="menuoptionpicker" hidden />
<input class="optionswitch__picker" type="checkbox" id="{{ $menuId }}" hidden />

{{ $labelClass := "optionswitch__label" }}
{{ range .Children }}
{{ range $menuItem.Children }}
{{ if eq $url .URL }}
{{ $labelClass = "optionswitch__label nav__link--active" }}


{{ end }}


{{ end }}


<label class="{{ $labelClass }}" for="menuoptionpicker"
>{{ .Name }} <i class="fa fa-angle-down" aria-hidden="true"></i
<label class="{{ $labelClass }}" for="{{ $menuId }}"
>{{ $menuItem.Name }} <i class="fa fa-angle-down" aria-hidden="true"></i
></label>

<div class="optionswitch__triangle"></div>
<ul class="optionswitch__list">
{{ range .Children }}
{{ range $menuItem.Children }}
<li class="optionswitch__list-item">
<a
href="{{ .URL }}"
Expand Down Expand Up @@ -72,7 +69,7 @@

{{ end }}
title="{{ .Title }}"
>{{ .Name }}</a
>{{ $menuItem.Name }}</a
>
</li>

Expand Down

0 comments on commit 1959fa6

Please sign in to comment.