(function () { 'use strict'; var MOBILE_BP = 1024; var headerSels = ['.elementor-location-header', 'header.site-header', '#masthead', 'header']; var contactMobileAttached = false; function isMobile() { return window.innerWidth <= MOBILE_BP; } function getHeaderBottom() { for (var i = 0; i < headerSels.length; i++) { var h = document.querySelector(headerSels[i]); if (h && h.getBoundingClientRect().height > 0) return h.getBoundingClientRect().bottom; } return 80; } function getLogoLeft() { for (var i = 0; i < headerSels.length; i++) { var h = document.querySelector(headerSels[i]); if (!h) continue; var links = Array.from(h.querySelectorAll('a')); for (var j = 0; j < links.length; j++) { var r = links[j].getBoundingClientRect(); if (r.left > 0 && r.width > 80) return Math.round(r.left); } } return 347; } function updateAllPanelTops() { if (isMobile()) return; var top = getHeaderBottom() + 'px'; ['menu-item-26410', 'menu-item-26353', 'menu-item-95'].forEach(function (id) { var li = document.getElementById(id); var panel = li && li.querySelector('.elementskit-megamenu-panel'); if (panel) panel.style.top = top; }); } function buildContactDesktop(li) { if (li.dataset.nexaContactDesktop) return; li.dataset.nexaContactDesktop = '1'; li.classList.remove('elementskit-dropdown-has'); li.classList.add('elementskit-megamenu-has'); var sub = li.querySelector('ul.elementskit-dropdown, ul.elementskit-megamenu-content'); if (sub) { sub.style.display = 'none'; sub.style.visibility = 'hidden'; } if (li.querySelector('.elementskit-megamenu-panel')) { updateAllPanelTops(); return; } var left = getLogoLeft(); document.documentElement.style.setProperty('--nexa-mega-left', left + 'px'); var cols = [ { icon: '\u{1F4AC}', name: 'General Inquiries', tag: "We're here to help", href: '/contact/' }, { icon: '\u{1F4CB}', name: 'Quote Request', tag: 'Get a free estimate', href: '/free-quote-request/' }, { icon: '\u{1F3A8}', name: 'Sample Request', tag: 'Try before you buy', href: '/sample-request/' }, { icon: '\u{1F4E6}', name: 'Track Order', tag: 'Check your order status',href: '/parcel-panel/' } ]; var inner = cols.map(function (c) { return '
' + '
' + c.icon + '
' + '
' + c.name + '
' + '
' + c.tag + '
' + 'Learn more →' + '
'; }).join(''); var panel = document.createElement('div'); panel.className = 'elementskit-megamenu-panel'; panel.style.top = getHeaderBottom() + 'px'; panel.innerHTML = '
' + inner + '
'; li.appendChild(panel); } function buildContactMobile(li) { if (li.dataset.nexaContactMobile) return; li.dataset.nexaContactMobile = '1'; var anchor = li.querySelector(':scope > a'); if (anchor && !contactMobileAttached) { contactMobileAttached = true; anchor.addEventListener('click', function (e) { if (!isMobile()) return; e.preventDefault(); e.stopPropagation(); li.classList.toggle('open'); }); } if (li.querySelector('.nexa-mobile-contact')) return; var cards = [ { icon: '\u{1F4AC}', name: 'General Inquiries', tag: "We're here to help", href: '/contact/' }, { icon: '\u{1F4CB}', name: 'Quote Request', tag: 'Get a free estimate', href: '/free-quote-request/' }, { icon: '\u{1F3A8}', name: 'Sample Request', tag: 'Try before you buy', href: '/sample-request/' }, { icon: '\u{1F4E6}', name: 'Track Order', tag: 'Check your order status',href: '/parcel-panel/' } ]; var html = cards.map(function (c) { return '' + '
' + '
' + c.icon + ' ' + c.name + '
' + '
' + c.tag + '
' + '
' + '
' + '
'; }).join(''); var panel = document.createElement('div'); panel.className = 'nexa-mobile-contact'; panel.innerHTML = html; li.appendChild(panel); } function applyContact() { var li = document.getElementById('menu-item-95'); if (!li) return; if (isMobile()) { if (li.dataset.nexaContactDesktop) { li.dataset.nexaContactDesktop = ''; li.classList.remove('elementskit-megamenu-has'); li.classList.add('elementskit-dropdown-has'); var panel = li.querySelector('.elementskit-megamenu-panel'); if (panel) panel.remove(); var sub = li.querySelector('ul.elementskit-dropdown'); if (sub) { sub.style.display = ''; sub.style.visibility = ''; } } buildContactMobile(li); } else { buildContactDesktop(li); updateAllPanelTops(); } } function init() { applyContact(); updateAllPanelTops(); [100, 300, 600, 1000, 2000].forEach(function (ms) { setTimeout(function () { applyContact(); updateAllPanelTops(); }, ms); }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); } window.addEventListener('load', function () { applyContact(); updateAllPanelTops(); }); var resizeTimer; window.addEventListener('resize', function () { clearTimeout(resizeTimer); resizeTimer = setTimeout(applyContact, 150); updateAllPanelTops(); }); window.addEventListener('scroll', updateAllPanelTops, { passive: true }); })();