PageSourceSearch

https://treemendoustreecarellc.net/wp-content/themes/hello-elementor-child/assets/js/mega-menu.js?ver=1.0.7

js treemendoustreecarellc.net collected 2026-10-08 23:34:41 UTC 3,082 bytes, 96 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2  'use strict';
3
4  const root = document.querySelector(':root'),
5    rootComputedStyle = getComputedStyle(root),
6    headerComputedStyle = getComputedStyle(document.getElementById('orb-site-header')),
7    megaOpenButton = document.getElementById('orb-mega-mobile-open'),
8    megaCloseButton = document.getElementById('orb-mega-mobile-close'),
9    megaBackground = document.getElementById('orb-mega-background'),
10    megaOverlay = document.getElementById('orb-mega-overlay'),
11    lightbox = document.getElementById('orb-mega-lightbox'),
12    megaMenu = document.getElementById('orb-mega-navigation'),
13    dropdowns = document.getElementsByClassName('orb-mega-dropdown'),
14    dropdownGroups = [];
15
16  let menuUp = false;
17
18  function createDropdownGroup (element) {
19    return {
20      container: element,
21      toggle: element.getElementsByClassName('orb-mega-toggle')[0],
22      visible: false
23    };
24  }
25
26  function toggleDropdown (group) {
27    group.visible = !group.visible;
28
29    if (group.visible) {
30      group.container.classList.add('orb-toggled');
31      megaBackground.classList.add('orb-toggled');
32      megaOverlay.classList.add('orb-toggled');
33      lightbox.classList.add('orb-toggled');
34    } else {
35      group.container.classList.remove('orb-toggled');
36      megaBackground.classList.remove('orb-toggled');
37      megaOverlay.classList.remove('orb-toggled');
38      lightbox.classList.remove('orb-toggled');
39    }
40  }
41
42  function closeDropdowns () {
43    for (const dropdown of dropdownGroups) {
44      if (dropdown.visible) {
45        toggleDropdown(dropdown);
46      }
47    }
48  }
49
50  if (megaOpenButton && megaCloseButton) {
51    megaOpenButton.addEventListener('click', function () {
52      megaMenu.classList.add('orb-toggled');
53      megaCloseButton.classList.add('orb-toggled');
54    });
55
56    megaCloseButton.addEventListener('click', function () {
57      megaMenu.classList.remove('orb-toggled');
58      megaCloseButton.classList.remove('orb-toggled');
59    });
60  }
61
62  for (const dropdown of dropdowns) {
63    dropdownGroups.push(createDropdownGroup(dropdown));
64  }
65
66  for (const dropdown of dropdownGroups) {
67    dropdown.toggle.onclick = function () {
68      if (!dropdown.visible) {
69        closeDropdowns();
70      }
71      toggleDropdown(dropdown);
72    };
73  }
74
75  lightbox.addEventListener('click', function () {
76    megaBackground.classList.remove('orb-toggled');
77    megaOverlay.classList.remove('orb-toggled');
78    lightbox.classList.remove('orb-toggled');
79    for (const dropdown of dropdownGroups) {
80      if (dropdown.visible) {
81        dropdown.visible = false;
82        dropdown.container.classList.remove('orb-toggled');
83      }
84    }
85  });
86
87  window.addEventListener('scroll', function () {
88    if (!menuUp && this.scrollY >= 10) {
89      menuUp = true;
90      root.style.setProperty('--mega-top', headerComputedStyle.height);
91    } else if (menuUp && this.scrollY == 0) {
92      menuUp = false;
93      root.style.setProperty('--mega-top', rootComputedStyle.getPropertyValue('--mega-top-initial'));
94    }
95  });
96});

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.