I'm trying to understand the logic in this codepen
https://codepen.io/tutsplus/pen/bGVPVrYand I'm confused by how classList is being used to add/remove the active class.
- variable menu is defined by const menu = document.querySelector(".menu");
- In HTML, class .menu is applied to the top ul element
- It seems to me that the code menu.classList.add("active"); is adding the class "active" to the ul element
- But in the codepen CSS, it appears to be added to <li class="item"> a child of menu.
I believe the ul element cannot be show/hide toggled directly, because it needs to remain displayed for non-mobile windows. I don't see that classList will recursively search children.
The codepen works so I'm missing something.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Fellow title is reserved for select members who demonstrate sustained contributions, industry leadership, and outstanding performance. We will announce the experts being inducted into the Experts Exchange Fellowship during the annual Expert Awards, but unlike other awards, Fellow is a lifelong status. This title may not be given every year if there are no obvious candidates.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.