Twitter Bootstrap Dropdown with Tabs inside

前端 未结 2 1612
星月不相逢
星月不相逢 2020-12-15 02:19

I\'m trying to make a dropdown menu with tabs inside of it. The problem is the dropdown closes when I click a tab. See this demo: http://jsfiddle.net/timrpeterson/pv2Lc/2/.

2条回答
  •  粉色の甜心
    2020-12-15 02:21

    The cited suggestion doesn't work because the .tab('show') method should be invoked on the actual tab (i.e., the link) instead of the tab pane.

    So the code should be:

    $('.dropdown-menu a[data-toggle="tab"]').click(function (e) {
        e.stopPropagation()        
        $(this).tab('show')
    })
    

    Here is an updated fiddle: http://jsfiddle.net/pv2Lc/6/

提交回复
热议问题