fix: Affichage du menu en JS vu qu'en CSS ça ne fonctionne pas sous iOS

This commit is contained in:
Simon 2020-12-20 00:59:40 +01:00
parent 5708a583d7
commit 29ecfc78ac
2 changed files with 15 additions and 18 deletions

View File

@ -164,12 +164,6 @@
flex-direction: column flex-direction: column
justify-content: center justify-content: center
&:hover
display: inherit
&:hover + .close-button
display: inherit
img img
display: inherit display: inherit
@ -213,16 +207,19 @@
display: none display: none
white-space: nowrap white-space: nowrap
&:focus + #menu
display: inherit
&:focus + #menu + .close-button
display: inherit
@media screen and (max-width: $size-md)
display: inherit
.close-button .close-button
white-space: nowrap white-space: nowrap
display: none display: none
z-index: 200 z-index: 200
@media screen and (max-width: $size-md)
.nav[data-open="true"]
.open-button
display: none
.close-button, #menu
display: inherit
.nav[data-open="false"]
.open-button
display: inherit
.close-button, #menu
display: none

View File

@ -13,14 +13,14 @@
sizes="(max-width: 600px) 500px, 1920px" sizes="(max-width: 600px) 500px, 1920px"
/> />
{{ end }} {{ end }}
<nav class="nav"> <nav class="nav" id="nav" data-open="false">
<div class="container"> <div class="container">
<div class="logo"> <div class="logo">
<a href="/" class=""> <a href="/" class="">
<img src="/icons/logo-entete-200x70.svg" alt="Blason de Crémeaux" /> <img src="/icons/logo-entete-200x70.svg" alt="Blason de Crémeaux" />
</a> </a>
</div> </div>
<button class="open-button">≡ Menu</button> <button class="open-button" onClick="document.getElementById('nav').setAttribute('data-open', true)">≡ Menu</button>
<ol id="menu"> <ol id="menu">
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
<li class="menu{{ if .HasChildren }} withSubmenu{{ end }}"> <li class="menu{{ if .HasChildren }} withSubmenu{{ end }}">
@ -39,7 +39,7 @@
</li> </li>
{{ end }} {{ end }}
</ol> </ol>
<button class="close-button">✖ Fermer</button> <button class="close-button" onClick="document.getElementById('nav').setAttribute('data-open', false)">✖ Fermer</button>
</div> </div>
</nav> </nav>
</header> </header>