简体   繁体   中英

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>

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM