Skip to content

Commit

Permalink
🐛Fix when there are no headers or links.
Browse files Browse the repository at this point in the history
See #16
  • Loading branch information
rowanc1 committed Jul 10, 2020
1 parent 55f7a14 commit 98bf0a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ export function setupNav() {
});

const header = document.querySelectorAll('nav > div')?.[0];
header.addEventListener('click', () => {
header?.addEventListener('click', () => {
if (window.innerWidth < 1500) {
header.parentElement?.classList.toggle('open');
}
});
const article = document.querySelectorAll('article')?.[0];
article.addEventListener('click', () => {
article?.addEventListener('click', () => {
header.parentElement?.classList.remove('open');
});
}
Expand Down

0 comments on commit 98bf0a1

Please sign in to comment.