Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKhadar Abdulahi
1,955 PointsMenu is not working
The Click event not working on menu where its shows no error on the console but it doesn't preform its task don't know why help!!!! https://w.trhou.se/jxaslazq23
2 Answers
Jennifer Nordell
Treehouse TeacherHi there, Khadar! For some reason, this question is linked to a challenge, but your question seems to be about your code in your workspace. You've correctly selected the element in question, but you're using nav.display
. This should be nav.style.display
.
You can find your corrected code below:
const menu =document.querySelector('#menu');
const nav =document.querySelector('#main_menu');
menu.addEventListener("click", ()=>{
if(nav.style.display=='block'){
nav.style.display='none';
}
else{
nav.style.display='block';
}
});
When I do this, your button works! However, you will need to refresh the page and possibly even clear the browser cache to see the changes.
Hope this helps!
Ashley Sinks
1,523 PointsI am running into an error for this question. Here is my code but I am getting "Bummer!"
gallery li {
width: 28.333%; }
izzy goldman
12,542 Pointsizzy goldman
12,542 PointsHi khadar, The challenge was At the bottom of this CSS file is a media query. Inside the media query, create a selector that chooses all list items that are nested inside the element with the id of "gallery". Then, inside your newly written selector, set the width property to a value of 28.3333%.
couldn't see a media query at bottom of css file.
try writing a media query with min-width: 480px and select the li with parents id of "gallery" and set it to width:28.3333%..