Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter bootstrap nav-pills with dropdown

I created nav-pills with Twitter bootstrap 3.
Everything is fine except dropdowns.
Documentation shows the layout for tab links, but not for the content: http://getbootstrap.com/components/#nav-dropdowns

I want to show content when user selects one of the dropdown links.

Fiddle is like this: http://jsfiddle.net/mavent/skL5H/3/

<div class="tabbable">
    <ul class="nav nav-tabs nav-pills" id="myTab">
        <li class="active"> <a href="#tab1" data-toggle="tab">Part 1</a>

        </li>
        <li class=""> <a href="#tab2" data-toggle="tab">Part 2</a>

        </li>
        <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Activity <span class="caret"></span></a>

            <ul class="dropdown-menu" role="menu">
                <li><a href="#tab3">Action</a>
                </li>
                <li><a href="#tab4">Another action</a>
                </li>
            </ul>
        </li>
    </ul>
    <br>
    <div class="tab-content">
        <div class="tab-pane active" id="tab1">aaaaaaaaaaaa</div>
        <div class="tab-pane" id="tab2">bbbbbbbbbbbb</div>
        <div class="tab-pane" id="tab3">cccccccccccccc</div>
        <div class="tab-pane" id="tab4">dddddddddddddd</div>
    </div>
</div>
like image 720
trante Avatar asked Feb 19 '14 09:02

trante


1 Answers

Add data-toggle="dropdown" to the links in the .dropdown-menu.

http://jsfiddle.net/skL5H/5/

like image 196
vonUbisch Avatar answered Sep 18 '22 14:09

vonUbisch