Design comparison
Solution retrospective
Looking for opinions on how i implemented the nav dropdown with Javascript? Is there a better way with less code?
I received an HTML error that my div menu close in mobile isn't proper since i included it inside a ul parent and it would have to be an li however updating it to an li with the dev tools makes it lose it's js functionality somehow - any feedback would be appreciated
Thanks
Community feedback
- @Jemi-codePosted over 2 years ago
Yes, there is a simpler way of doing it using just html. There is a tag called details tag(<details>) which helps to create drop down menus without having to code JS. I did this same challenge, is this is how I did my HTML.
<details> <summary>Features</summary> <ul class="feat-list"> <li class = "todo">Todo List</li> <li class = "cal">Calender</li> <li class = "rem">Reminders</li> <li class = "plan">Planning</li> </ul> </details>For the div menu close issue, try putting it outside the list but still within the nav and set the position to absolute
0@asagandaPosted over 2 years ago@Jemi-code Need js code for interactive click event listener to open list menu items though, how does changing to markup to using details tag improve/remove the need for use of js?
0@Jemi-codePosted over 2 years ago@asaganda You don't really need Node.js to open list menu items. Luckily, HTML has some provided. However you will need js for the mobile drop down navigation view
0@asagandaPosted over 2 years ago@Jemi-code I never said node.js I am simply stating that i wrote plain javascript and used its event listener functionality to toggle the list menu items
0@Jemi-codePosted over 2 years ago@asaganda Yes sorry about that. I was reading a bit too fast. Yes you can use javascript, if you like, however HTML can also be used
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord