Sha256: d581a0db2e910689e4a8e788c0074f19421e1bb35161d735c9fc2ed96f647902
Contents?: true
Size: 1.62 KB
Versions: 5
Compression:
Stored size: 1.62 KB
Contents
export function navigate(elementId) { const tabGroups = document.querySelectorAll('.tab-groups'); const desktopNav = document.querySelectorAll('.desktop-nav > a'); const mobileNav = document.querySelectorAll('.mobile-nav > a'); for (var i = 0; i < tabGroups.length; i++) { var txtValue = tabGroups[i].attributes.name.value; if (txtValue.indexOf(elementId) > -1) { tabGroups[i].classList.remove('hidden'); } else { tabGroups[i].classList.add('hidden'); } } for (var i = 0; i < desktopNav.length; i++) { if (desktopNav[i].attributes.name.value == elementId) { desktopNav[i].classList.remove( 'text-gray-300', 'hover:text-white', 'hover:bg-gray-700', 'focus:text-white', 'focus:bg-gray-700', ); desktopNav[i].classList.add('text-white', 'bg-gray-900'); } else { desktopNav[i].classList.remove('text-white', 'bg-gray-900'); desktopNav[i].classList.add( 'text-gray-300', 'hover:text-white', 'hover:bg-gray-700', 'focus:text-white', 'focus:bg-gray-700', ); } } for (var i = 0; i < mobileNav.length; i++) { if (mobileNav[i].attributes.name.value == elementId) { mobileNav[i].classList.remove( 'text-gray-300', 'hover:text-white', 'hover:bg-gray-700', 'focus:text-white', 'focus:bg-gray-700', ); mobileNav[i].classList.add('text-white', 'bg-gray-900'); } else { mobileNav[i].classList.remove('text-white', 'bg-gray-900'); mobileNav[i].classList.add( 'text-gray-300', 'hover:text-white', 'hover:bg-gray-700', 'focus:text-white', 'focus:bg-gray-700', ); } } } window.navigate = navigate;
Version data entries
5 entries across 5 versions & 2 rubygems