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

JavaScript

Vertical Menu toggle

Hello everyone. I am having some difficulty toggling my vertical slide menu. Before I added the class .active-nav, my menu wasn't toggling.After I added the class .active-nav, my menu is showing but not toggling. What am I doing wrong here? Here is my code pen link and thank you http://codepen.io/Layee/pen/VLbobN

3 Answers

Short answer was that the toggleClass parameter doesn't need a period to denote class, just the class name:

BodyEl.toggleClass("active-nav"); 

Got it working here [http://codepen.io/JEverhart383/pen/jPmgoY]

okay, thank you but how do I hide the menu when the page loads? I only want to toggle it if the user clicked on it. thank you again.

Just remove the line where you manually add the active-nav class to the body. Check out the pen. I just updated it.

Thank Jeff a lot.