Comment

Comment by lysecret

I mean I hate JS as much as the next person. Also, for my blog I wanted to use as minimal JS as possible. But when it comes to a sidebar I don't think adding a few lines like this is soo bad.

    <script>
    const button_close = document.querySelector('#menu-button- 
    close'); 
    const button_open = document.querySelector('#menu-button- 
    open'); 
    const menu = document.querySelector('#menu'); // Menu

    button_close.addEventListener('click', () => {
       menu.classList.toggle('hidden');
    });
    button_open.addEventListener('click', () => {
      menu.classList.toggle('hidden');
    });
    </script>
parent lysecret 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton