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

header.html « partials « layouts - github.com/darshanbaral/kitab.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7e7612643dc1f22603d045fe82b0ae8e47cebaf1 (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
<nav>
  <div class="d-flex flex-row mt-2 border-bottom position-relative">
    <a href="{{ `/` | relURL }}"
      ><i title="Home" class="nav-menu mr-2 mt-1 fas fa-home"></i
    ></a>
    {{ partial "bookMenu" . }}
    {{ if eq .Kind "page" }}
    {{ partial "chapterMenu" . }}
    {{ end }}
    <div class="w-100 text-right">
      {{ partial "footer" . }}
    </div>
  </div>
</nav>
<script>
  let expandMenu = function(x) {
    Array.from(document.querySelectorAll(".hover-menu")).forEach(hovermenu => {
      hovermenu.nextElementSibling.style.maxHeight = "0px";
    });
    let thisMenu = x.nextElementSibling;
    thisMenu.style.maxHeight = thisMenu.scrollHeight + "px";
  };
  window.onclick = function(event) {
    let insideMenu = false;
    Array.from(document.querySelectorAll(".show")).forEach(menu => {
      insideMenu = insideMenu || menu.contains(event.target);
    });
    if (!insideMenu && !event.target.matches(".hover-menu")) {
      Array.from(document.querySelectorAll(".hover-menu")).forEach(
        hovermenu => {
          hovermenu.nextElementSibling.style.maxHeight = "0px";
        }
      );
    }
  };
</script>