Skip to content

Commit

Permalink
temp commit for menus.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfisher committed Nov 14, 2024
1 parent cee5d44 commit ba50e5c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions dev/js/main2.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ $(document).ready(function(){

// Before toggling menu, change default header menu class to non-selected state and change default aria attribute:

// According to ChatGPT using aria-hidden for visual appearance isn't recommended and items should not be hidden from
// screen readers. Instead, use aria-expanded to indicate the state of the menu.
$('#js-header__nav').attr('class', 'header__nav');
$('#js-header__nav').attr('aria-hidden', 'true');
$('#js-header__nav').attr('aria-expanded', 'false');

// Toggle classes and attributes:
$('#js-header__nav-button').click(function(){

$('#js-header__nav').toggleClass('header__nav header__nav--selected', 300, 'easeInOutCubic');

if($('#js-header__nav').attr('aria-hidden') == 'true') {
$('#js-header__nav').attr('aria-hidden', 'false');
if($('#js-header__nav').attr('aria-expanded') == 'false') {
$('#js-header__nav').attr('aria-expanded', 'true');
} else {
$('#js-header__nav').attr('aria-hidden', 'true');
$('#js-header__nav').attr('aria-hidden', 'false');
}

});
Expand Down Expand Up @@ -62,18 +64,25 @@ $(document).ready(function(){
// Toggle open and closed from login button

$('#js-header__loginout-button').click(function(){
if ($('#js-login-modal').attr('aria-hidden') == 'true') {
$('#js-login-modal').attr('aria-hidden', 'false');
}else {
$('#js-login-modal').attr('aria-hidden', 'true');
}
$('#js-login-modal').fadeToggle(200);
});

// Close when close icon is clicked

$('#js-login-modal__close').click(function(){
$('#js-login-modal').attr('aria-hidden', 'true');
$('#js-login-modal').fadeToggle(200);
});

// Close when form is submitted

$('#js-login-modal__form').submit(function(){
$('#js-login-modal').attr('aria-hidden', 'true');
$('#js-login-modal').fadeToggle(200);
});

Expand Down

0 comments on commit ba50e5c

Please sign in to comment.