Skip to content

Commit

Permalink
hamburger logic changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Mujtaba Sayed authored and Mujtaba Sayed committed Jul 3, 2024
1 parent 807de40 commit 1c94740
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions blocks/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default async function decorate(block) {
</button>`;
hamburger.addEventListener('click', (e) => {
toggleMenu(nav, navSections)
hamburgerHandler(e);
hamburgerHandler();
});
nav.prepend(hamburger);
nav.setAttribute('aria-expanded', 'false');
Expand Down Expand Up @@ -210,10 +210,10 @@ function clickToShowMobileNavDropDown(){
})
}

function hamburgerHandler(e){
if(e.target.parentNode.getAttribute('aria-label') == "Close navigation"){
function hamburgerHandler(){
if(document.querySelector('.nav-hamburger').querySelector('[aria-label]').ariaLabel.toLowerCase() == "close navigation"){
document.querySelector('.section.mobile-view-header').style.display = 'block';
}else if(e.target.parentNode.getAttribute('aria-label') == "Open navigation"){
}else if(document.querySelector('.nav-hamburger').querySelector('[aria-label]').ariaLabel.toLowerCase() == "open navigation"){
document.querySelector('.section.mobile-view-header').style.display = 'none';
}
}

0 comments on commit 1c94740

Please sign in to comment.