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

khata.js « js « static - github.com/darshanbaral/khata.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6dcba90681e45df7361ae02692d3902d053e1d7d (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
let toggleHeight = function(elem) {
  if (getComputedStyle(elem)["height"] === "0px") {
    elem.style.maxHeight = elem.scrollHeight + 5 +"px";
  } else {
    elem.style.maxHeight = "0px";
  }
};
let toggleDisplay = function(elem) {
  elem.classList.toggle("d-none");
};
let zeroHeight = function(elem) {
  elem.style.maxHeight = "0px";
};
let checkClick = function() {
  if (!document.querySelector(".dropdown").contains(event.target)) {
    zeroHeight(document.querySelector(".dropdown-content"));
  }
  if (
    window.matchMedia("(max-width: 750px)").matches &&
    !document.querySelector("nav").contains(event.target)
  ) {
    document.querySelector(".all-menu").classList.add("d-none");
  }
};
window.onclick = function() {
  checkClick();
};
window.ontouchstart = function() {
  checkClick();
};