Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Konrad Pilch
Konrad Pilch
2,435 Points

How to get a child dropdown menu? -jQuery


So if you look on this codepen and you toggle the link that has a submenu, as youc an see, i placed that submenu with absolute position to position it.

If we look at bootstrap, here and you click the submenu, they are relative to the main link, placed underneeth them, no matter where they are, and me instead, i used absolute left 100px so tyle it etc..

How can i make a submenu or menu like bootstrap?

1 Answer

Tushar Singh
Tushar Singh
Courses Plus Student 8,692 Points

I used something similar to this http://codepen.io/tushar_13/pen/WwXVGB --hovertext over the buttons, you can check it out.(regarding the positioning)--your relativity issue.

But I think in this case you can use slideup and slidedown(jquery)-that's what you are using in the bootstrap.

What I mean by that is when a user clicks/hovers(your wish), you you can use the children() property to slideup or slideDown your list items.

I think this is what you are looking for http://callmenick.com/post/slide-down-menu-with-jquery-and-css