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 trial
Abe Layee
8,378 PointsMenu not staying down when click.
Hello fellow students. I have a little bit of problem with my responsive menu. When the menu is at 480px and clicked, it does not stay down. It fades out fast. Also, when my nav is floated right, the menu reverses to Contact,About,Portfolio,and Home. Thanks. Here is the codepen http://codepen.io/Layee/pen/MweYjY
$(document).ready(function() {
$('.menu-trigger').click(function() {
//show menu and on large screen
$('.nav-menu').slideToggle(1000, function() {
$(this).toggleClass('nav-expanded').css('display', ' '); //the menu doesn't stay down after you clicked on it.
});
});
});
1 Answer
Lucus Lovell
2,654 PointsI think the issue is in your CSS not the javascript.
I have updated the Codepen http://codepen.io/anon/pen/VLjLrO
The css for displaying the expanded nav should be as follows. This sets a more specific class for displaying block.
/now show the menu again for larger devices/ div.nav-menu.nav-expanded { display: block; }
Hope this helps
Abe Layee
8,378 PointsAbe Layee
8,378 PointsThank you for your help.