aboutsummaryrefslogtreecommitdiff
path: root/themes/hugo-pt2021/assets/script.js
blob: bc95b27d59ad6a24b3178d3eb799d7aeea43b40a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// enable burger menu support
// src: https://bulma.io/documentation/components/navbar/
document.addEventListener('DOMContentLoaded', () => {
  "use strict";
  // iterate through burgers
  Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0).forEach(e => {
    e.addEventListener('click', () => {
      // get target from data-target attribute
      const t = document.getElementById(e.dataset.target);

      // toggle is-active on both burger and menu
      [e, t].forEach(e => e.classList.toggle('is-active'));
    });
  });
});