PageSourceSearch

https://www.pythondiscord.com/static/extensions/bulma-navbar-burger/dist/js/bulma-navbar-burger.js

js pythondiscord.com collected 2026-10-02 05:04:28 UTC 1,302 bytes, 34 lines download raw bytes

1/*****
2 * A DOMContentLoaded event listener for use with Bulma that connects the "click" event of each
3 * navbar-burger element with the navbar-menu referred to by ID in the "data-target" attribute.
4 *
5 * This file is a slightly modified version of the example found in the Bulma documentation for
6 * the navbar component. It's been updated for some of the newer Javascript standards, but will
7 * otherwise behave in exactly the same way.
8 *
9 * Bulma documentation page: https://bulma.io/documentation/components/navbar/#navbarJsExample
10 *****/
11
12document.addEventListener('DOMContentLoaded', () => {
13
14  // Get all "navbar-burger" elements
15  const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
16
17  // Check if there are any navbar burgers
18  if ($navbarBurgers.length > 0) {
19
20    // Add a click event on each of them
21    $navbarBurgers.forEach($el => {
22      $el.addEventListener('click', function () {
23
24        // Get the target from the "data-target" attribute
25        const target = $el.dataset.target;
26        const $target = document.getElementById(target);
27
28        // Toggle the class on both the "navbar-burger" and the "navbar-menu"
29        $el.classList.toggle('is-active');
30        $target.classList.toggle('is-active');
31      });
32    });
33  }
34});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.