Coding task · JavaScript and TypeScript course · Module 8: Events and the DOM

Exercise: Responsive Menu

Create a responsive hamburger menu for the Jurassic Park website.

Task

The index.html file has a #menu-toggle button and a #main-menu menu. On a narrow screen style.css shows the menu only when it has the open class (on a screen wider than 900 px the menu is always visible and the button is hidden). Fill in the blanks: ___BLANK1___ is the click event, and ___BLANK2___ is the classList method that adds the open class when it is missing and removes it when it is there (returning true or false). The first click should expand the menu and set aria-expanded="true", the second should collapse it and set aria-expanded="false".