notes/public/resources/js/modules/mobile-nav/index.js

27 lines
555 B
JavaScript
Raw Permalink Normal View History

2026-06-05 14:31:12 -06:00
import $$ from '@utilities/selectors'
const MobileNav = function MobileNav()
{
$$.mobileNavToggle.addEventListener('click', function() {
this.classList.toggle('expanded')
$$.mobileNav.classList.toggle('menu-visible')
// set aria-expanded attribute on menu toggle button
if ( this.getAttribute('aria-expanded') === 'false' )
{
this.setAttribute('aria-expanded', 'true')
} else {
this.setAttribute('aria-expanded', 'false')
}
})
}()
export default MobileNav