Español
Beta]]> `; // this creates the Tool Tip cw 2025-01-10 // Initialize Tippy.js on the globe icon tippy(‘#espanolBetaLabel’, { content: `
Español Beta
AirNow is beta testing a Spanish language translation of our entire web site. `, allowHTML: true, placement: ‘bottom’, zIndex: 9999, offset: [-75, 100], theme: “marquee”, animation: “shift-toward”, // shift toward; scale delay: [300, 100], interactiveBorder: 5, arrow: true, }); tippy(‘#globeIcon’, { content: `
Español Beta
AirNow is beta testing a Spanish language translation of our entire web site. `, allowHTML: true, placement: ‘bottom’, zIndex: 9999, offset: [-75, 100], theme: “marquee”, animation: “shift-toward”, // shift toward; scale delay: [300, 100], interactiveBorder: 5, arrow: true, }); // For Mobile Hamburger menu ONLY cw 2025-01-27 // Check if the viewport width is less than 767 pixels if (window.innerWidth < 767) { // Move the element after the dropdown search, and before the Hambuger menu var dropdownSearch = document.querySelector('.dropdown.dropdown-search'); if (dropdownSearch) { dropdownSearch.insertAdjacentElement('afterend', element); } // Move globeIcon up & over document.getElementById('espanolBetaLabel').style.display = 'none'; document.getElementById('globeIcon').style.marginTop = '-16px'; document.getElementById('globeIcon').style.marginLeft = '0px'; document.getElementById('globeIcon').style.marginRight = '0px'; document.getElementById('globeIcon').style.float = 'right'; // Move Hamburger up // style="margin-top: -28px;margin-right: -5px;" var mobileDropdown = document.querySelector('.mobile-dropdown'); if (mobileDropdown) { mobileDropdown.style.marginTop = '-28px'; mobileDropdown.style.marginRight = '-5px'; // Ensure that the Mobile Hamburger menu is clickable by making it "on top" of everything else cw 2025-01-28 mobileDropdown.style.position = 'relative'; mobileDropdown.style.zIndex = '101'; } // Move Location Label over var locationLabel = document.querySelector('.location-label'); if (locationLabel) { locationLabel.style.marginRight = '13px'; } // postion the globe globeLanguageSwitcher.textContent = 'Español'; globeLanguageSwitcher.style.display = 'none'; globeLanguageSwitcher.style.position = 'absolute'; globeLanguageSwitcher.style.top = '78px'; // snug it up to the bottom of the Nav menu bar globeLanguageSwitcher.style.right = '13px'; // center the menu under the globe globeLanguageSwitcher.style.zIndex = '102'; // up on top globeLanguageSwitcher.style.padding = '10px'; // Add a border to the globeLanguageSwitcher; alows the normal button styles to be used cw 2025-01-28 globeLanguageSwitcher.style.border = ''; // Reposition the search icon var searchIcon = document.getElementById('search-btn'); if (searchIcon) { searchIcon.style.paddingRight = '6px'; searchIcon.style.paddingLeft = '6px'; } // Add event listener to handle the mobile drop down menu cw 2025-012-28 document.getElementById('globeIcon').addEventListener('click', function() { // hide menu on second click cw 2025-01-28 if (globeLanguageSwitcher.style.display === 'none') { globeLanguageSwitcher.style.display = 'block'; } else { globeLanguageSwitcher.style.display = 'none'; } if (window.location.href.includes('espanol.airnow.gov')) { globeLanguageSwitcher.textContent = 'English'; // Display English } else { globeLanguageSwitcher.textContent = 'Español'; // Display Espanol } }); // Add event listener to handle the actual language change cw 2025-012-23 document.getElementById('globeLanguageSwitcher').addEventListener('click', function() { if (window.location.href.includes('espanol.airnow.gov')) { // send to English window.location.href = 'https://www.airnow.gov/' + displayPath; // switch to English cw 2025-01-16 } else { window.location.href = 'https://espanol.airnow.gov/' + displayPath; // switch to Spanish cw 2025-01-16 } }); } else { // For Desktop // Set the "switcher" to display the opposite of the current language cw 2025-01-10 if (window.location.href.includes('espanol.airnow.gov')) { // then set to Spanish globeLanguageSwitcher.textContent = 'English'; espanolBetaLabel.style.display = 'none'; globeLanguageSwitcher.style.display = 'block'; } else { // then set to English globeLanguageSwitcher.textContent = 'Español'; espanolBetaLabel.style.display = 'block'; globeLanguageSwitcher.style.display = 'none'; } // Add event listener to handle the actual language change cw 2025-012-23 document.getElementById('globeIcon').addEventListener('click', function() { if (window.location.href.includes('espanol.airnow.gov')) { // send to English window.location.href = 'https://www.airnow.gov/' + displayPath; // switch to English cw 2025-01-16 } else { window.location.href = 'https://espanol.airnow.gov/' + displayPath; // switch to Spanish cw 2025-01-16 } }); // Add event listener to toggle dropdown visibility when "Espanol Beta" is clicked document.getElementById('espanolBetaLabel').addEventListener('click', function() { // go straight to spanish window.location.href = 'https://espanol.airnow.gov/' + displayPath; // switch to Spanish cw 2025-01-16 }); // Add event listener to handle the actual language change document.getElementById('globeLanguageSwitcher').addEventListener('click', function() { if (window.location.href.includes('espanol.airnow.gov')) { // send to English window.location.href = 'https://www.airnow.gov/' + displayPath; // switch to English cw 2025-01-16 } else { window.location.href = 'https://espanol.airnow.gov/' + displayPath; // switch to Spanish cw 2025-01-16 } }); } // end of Desktop var element = document.getElementById('recursos-en-español-btn'); element.style.display = 'block'; // Make the element visible again }
Source