-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #294 from RockefellerArchiveCenter/development
Update style library version
- Loading branch information
Showing
3 changed files
with
27 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
// Handles clicks on the mobile nav toggle button | ||
|
||
document.getElementById('nav-toggle').addEventListener('click', function() { | ||
const expandedCurrent = this.getAttribute('aria-expanded') | ||
const expandedCurrent = this.getAttribute('aria-expanded'); | ||
|
||
// Sets classes and attributes on the nav-toggle | ||
this.classList.toggle('active') | ||
this.classList.toggle('closed') | ||
this.setAttribute('aria-expanded', expandedCurrent === 'true' ? 'false' : 'true') | ||
this.classList.toggle('active'); | ||
this.classList.toggle('closed'); | ||
this.setAttribute('aria-expanded', expandedCurrent === 'true' ? 'false' : 'true'); | ||
|
||
// Sets classes and attributes on the nav-toggle-menu | ||
menu = document.getElementById('nav-toggle-menu') | ||
menu.classList.toggle('active') | ||
menu.classList.toggle('closed') | ||
}) | ||
const menu = document.getElementById('nav-toggle-menu'); | ||
menu.classList.toggle('active'); | ||
menu.classList.toggle('closed'); | ||
|
||
// Toggles tabindex values for each link | ||
const links = menu.querySelectorAll('.dropdown__btn--mobile'); | ||
const isActive = menu.classList.contains('active'); | ||
links.forEach(link => { | ||
link.tabIndex = isActive ? 0 : -1; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters