forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnav.js
More file actions
13 lines (11 loc) · 446 Bytes
/
nav.js
File metadata and controls
13 lines (11 loc) · 446 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
export default function () {
// Open and close mobile nav
const hamburgerButton = document.querySelector('.nav-mobile-burgerIcon')
const mobileDropdown = document.querySelector('.nav-mobile-dropdown')
if (!(hamburgerButton && mobileDropdown)) return
hamburgerButton.addEventListener('click', (event) => {
event.preventDefault()
hamburgerButton.classList.toggle('js-open')
mobileDropdown.classList.toggle('js-open')
})
}