Fri Oct. 20

Helpful Resources & Portfolio Exercises

9 – 12h Teaching

Goals

  • I did present a link related to the topics of the last 2 weeks (JavaScript)
  • My personal home page contains a burger menu that works
  • My personal home page uses JavaScript to select the current menu item

Research & Presentation

What resource (link / slide / example) was the most helpful or inspiring during the last two weeks? Do some research (15min).

Please present it to your colleagues (2-3min each).

Check out the Slack channel #zrh-class for all the links of your colleagues

Portfolio Page - Responsive Menu

Based on the example in the presentation slides and the things you learned in the last 2 weeks, add a menu toggle button to your portfolio page.

Steps:

  • get a reference to the burger button
  • get a reference to the box containing the menu to be shown / hidden
  • write a function burgerMenuShowHide that shall be executed every time the burger button has been pressed:
    • if the menu is hidden (display:none), show it
    • if the menu is shown (display:block), hide it
  • add the function to the "click" event listener of the burger button

(Hüni's solution)

12 – 13.30h Lunch

13.30 – 16h Coaching

Portfolio Page - Auto-Select Menu Items

Instead of adding a class="selected" to a menu item on each page, we can write a JavaScript that does this for us. The page URL actually shows us everything we need to know: the last part of the URL is the same like our href="..." attribute in the page link:

Steps:

(Hüni's solution)

one more thing about the burger menu...

...you actually can do it without JavaScript. But you need to be very good at CSS!