Hello all, this is my first attempt at making a simple hamburger menu to try and finish off my landing page. I have no idea what I’m doing and essentially tried to adjust some code for a previous project that had the classes and JS laid out. Still I’ve run into some issues as you can see. The dropdown doesn’t work, and it isn’t placed well (I can probably figure this out, unless it’s more complicated than it first looks)
For mobile version, I’d like to move my Bon logo to the center, for some reason I haven’t been able to get this to happen. I’ve tried applying a centering margin on the .logo and #header-img without any luck.
Another issue I’ve discovered is my nav-list. I cant figure out why it is pushed to the right as I’ve discovered with devtools. I’ve tried playing around with this class as well as nav-item. Help or tips appreciated.
Thanks for your suggestion.
I still am not sure as to why my burger menu does not work. I have checked it against the code I borrowed it from (Kevin Powell) and made sure I have like for like, his example did not have any added specificity and I am really not familiar with specificity myself, so forgive my ignorance there.
I have REALLY struggled with the video aspect of this project, the video is always too small and does not behave as I would expect when using flex:1 (no change) or putting a percentage for width (makes the video even smaller and creates a white space between it and .sirene-prouduct
In any case I have messed around with this and the footer section ( think I have this fixed now) so much that I have now created some side scrolling that does not show the overflow on Chrome dev tools so I guess you might say I am a bit stuck.
When borrowing code you will often not be able to just plug and play because the code you’re borrowing may depend on other things that you don’t have set up correctly. But there is nothing wrong with looking at someone else’s code to get an idea of how they are doing it and then implementing it yourself.
As for the hamburger icon, it is showing up for me when I narrow the view port, it’s just not doing anything when I click it. One of the first places you should look is the console tab in your browser’s dev tools. That place often has the answers to your questions
You add this class to the element when clicking the menu. It can not overwrite the CSS set in the id selector as a class selector has lower specificity.
Aaah thank you, this is really helpful!
Yes as I haven’t done this before I didn’t know that the nav in nav.classList.toggle("nav--visible"); should be my id name specifically (vs targeting the <nav> directly).
The information about the visibility is along the same lines, so the error in CSS makes a lot of sense too.
I normally use classes rather than id’s, but as it is something needed to pass the test suite…this was the only difference between mine and the code that I borrowed, it makes a big difference.
To bbsmooth, thanks for the tip on the console section of devtools. Unfortunately I don’t know what it actually means…yet. I guess it means some things are not matching up as they should as lasjorg mentioned.