We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 944b639 commit 6281b98Copy full SHA for 6281b98
site/static/js/burger.js
@@ -0,0 +1,16 @@
1
+document.addEventListener('DOMContentLoaded', () => {
2
+ // Get "navbar-burger" element
3
+ const el = document.querySelector('.navbar-burger');
4
+
5
+ // Add a click event
6
+ el.addEventListener('click', () => {
7
8
+ // Get the targets from the "data-target" attribute
9
+ const target = el.dataset.target;
10
+ const $target = document.getElementById(target);
11
12
+ // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
13
+ el.classList.toggle('is-active');
14
+ $target.classList.toggle('is-active');
15
+ });
16
+});
0 commit comments