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

Simple click dropdown

I'm not good at javascript and really need to start learning it. But now I'm trying to add a simple click to drop down menu. I have the html/css working right but would like to add a drop down so that mobile people can use it. Hover is not an option for it.

My link to my code. http://cssdeck.com/labs/0pgruqby

2 Answers

Richard,

You may not need to use javascript. Utilizing just html/css you can create a drop down menu. Hope this helps.

Actually, I believe that hover does work on touch-screens. When users quickly tap an element, the hover elements are revealed and the link is not activated. Still, it's probably not the most ideal of solutions.

Here's a pen to help you out. It's a simple case of using jQuery's slide methods to hide and show the nav while using classes to track its state.