Welcome to mirror list, hosted at ThFree Co, Russian Federation.

header.html « partials « layouts - github.com/darshanbaral/khata.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9c399f44885beec362f67767684315b590682305 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<div class="header">
  <nav id="main-nav" class="standard">
    <div>
      <i
        class="hamburger fas fa-bars"
        onclick="toggleDisplay(this.parentNode.nextElementSibling)"
      ></i>
    </div>
    <div class="all-menu expanded w-100">
      {{ partial "menu/menu_home" . }}
      {{ partial "menu/menu_sections" . }}
      {{ partial "menu/menu_alltaxa" . }}
      {{ partial "menu/menu_archives" . }}
    </div>
  </nav>
</div>
<script>
  function smMenu(x) {
    let allMenu = document.querySelector(".all-menu");
    let dropDown = document.querySelector(".dropdown-content");
    if (x.matches) {
      allMenu.classList.add("d-none");
      allMenu.style.flexDirection = "column";
      dropDown.style.width = "calc(90vw - 5px)";
      dropDown.style.maxHeight = "0px";
      dropDown.style.position = "static";
    } else {
      dropDown.style.width = "auto";
      allMenu.classList.remove("d-none");
      allMenu.style.flexDirection = "row";
      dropDown.style.maxHeight = "0px";
      dropDown.style.position = "absolute";
    }
  }

  let x = window.matchMedia("(max-width: 750px)");
  smMenu(x); // Call listener function at run time
  x.addListener(smMenu); // Attach listener function on state changes
</script>