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


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