mirror of https://github.com/lxndrblz/anatole.git

Pedro Lima
06.35.2022 c6507c76a77122596e4edce59c5620f3be4cd45d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
document.addEventListener('DOMContentLoaded', function () {
  // Get all "navbar-burger" elements
  var $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
  var nav = document.querySelector('nav');
  // Check if there are any navbar burgers
  if ($navbarBurgers.length > 0) {
    // Add a click event on each of them
    $navbarBurgers.forEach(function ($el) {
      $el.addEventListener('click', function () {
        var target = $el.dataset.target;
        var $target = document.getElementById(target);
        $el.classList.toggle('is-active');
        $target.classList.toggle('is-active');
        nav.classList.toggle('is-active');
      });
    });
  }
});