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

mero.js « js « static - github.com/darshanbaral/mero.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 262f64aa7818fcdc7a3e3ed3cd5d54ea0b4dfdca (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
setColors = function() {
  let images = Array.from(document.querySelectorAll("img"));
  images.forEach(elem => elem.classList.add("img-fluid", "rounded"));

  let imagecaption = Array.from(document.querySelectorAll("figcaption"));
  imagecaption.forEach(elem => elem.classList.add("initialism"));
};
window.onload = setColors;

let toggleMenu = function(x) {
  let elem = x.nextElementSibling;
  if (elem.classList.contains("d-none")) {
    elem.classList.remove("d-none");
  } else {
    elem.classList.add("d-none");
  }
};
let checkClick = function() {
  let menuContainer = document.querySelector(".dropdown-content");
  if (
    !menuContainer.contains(event.target) &&
    !document.querySelector(".dropdown").contains(event.target)
  ) {
    menuContainer.classList.add("d-none");
  }
};
window.onclick = function() {
  checkClick();
};
window.ontouchstart = function() {
  checkClick();
};