Html Bootstrap.btn组在

Html Bootstrap.btn组在,html,twitter-bootstrap,twitter-bootstrap-3,Html,Twitter Bootstrap,Twitter Bootstrap 3,我使用.btn组作为一组选项卡的导航元素。它似乎按照预期运行;但是,当单击组中的任何给定按钮时,它将获取.active类。现在,这很好,但问题是,即使单击另一个按钮,它也会保留这个类。这是一个例子。“配置”下的三个橙色按钮组显示意外行为。我尝试了一切,从重新设计各种div的嵌套到包含.container到在行和各种大小的列中嵌套所有内容,但完全无法根除这种行为 我知道,每当单击.btn组的另一个成员时,使用jQuery清除.active类相对来说是很简单的,但是这种行为似乎是意外的,可能是代码中

我使用
.btn组作为一组选项卡的导航元素。它似乎按照预期运行;但是,当单击组中的任何给定按钮时,它将获取
.active
类。现在,这很好,但问题是,即使单击另一个按钮,它也会保留这个类。这是一个例子。“配置”下的三个橙色按钮组显示意外行为。我尝试了一切,从重新设计各种
div
的嵌套到包含
.container
到在
行和各种大小的
列中嵌套所有内容,但完全无法根除这种行为

我知道,每当单击
.btn组的另一个成员时,使用jQuery清除
.active
类相对来说是很简单的,但是这种行为似乎是意外的,可能是代码中某个地方的错误造成的。但是,如果此行为是错误导致的,我将找不到它。

请查看:。您将发现一个使用带有下拉列表的选项卡的示例。现在您使用的是btn组而不是选项卡

您可以使用tabs javascript插件中的
data toggle=“tab”
。这个插件需要一些与当前结构不同的html结构。另请阅读:这将显示选项卡也有一个类
.nav justified

因此,请使用以下内容替换您的btn组以解决您的问题:

<ul class="nav nav-tabs nav-justified" id="myTab">
        <li class=""><a data-toggle="tab" href="#home">Home</a></li>
        <li class=""><a data-toggle="tab" href="#profile">Profile</a></li>
        <li class="dropdown active">
          <a data-toggle="dropdown" class="dropdown-toggle" id="myTabDrop1" href="#">Dropdown <b class="caret"></b></a>
          <ul aria-labelledby="myTabDrop1" role="menu" class="dropdown-menu">
            <li class="active"><a data-toggle="tab" tabindex="-1" href="#dropdown1">@fat</a></li>
            <li class=""><a data-toggle="tab" tabindex="-1" href="#dropdown2">@mdo</a></li>
          </ul>
        </li>
</ul>
      <div class="tab-content" id="myTabContent">
        <div id="home" class="tab-pane fade">
          <p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</p>
        </div>
        <div id="profile" class="tab-pane fade">
          <p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p>
        </div>
        <div id="dropdown1" class="tab-pane fade active in">
          <p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.</p>
        </div>
        <div id="dropdown2" class="tab-pane fade">
          <p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.</p>
        </div>
生料牛仔布你可能没听说过,奥斯汀牛仔短裤。雀巢豆腐阿利夸,复古合成大师清洗。威廉斯堡卡尔斯素食者赫尔维蒂卡的胡子陈词滥调。Reprehenderit butcher retro keffiyeh dreamcatcher synth。Cosby毛衣eu banh mi,qui irure terry richardson前鱿鱼。salvia cillum iphone上的Aliquip placeat。Seitan aliquip quis羊毛衫美国服装,屠夫voluptate nisi qui

食品卡车修理工,accusamus mcsweeney的marfa nulla单一来源咖啡鱿鱼。实习+1 labore velit,blog服装PBR紧身裤下一级wes anderson artisan four loko农场到餐桌工艺啤酒花呢。Qui photo booth活版印刷,commodo enim craft beer mlkshk aliquip jean短裤ullamco ad乙烯基纤毛PBR。有机诺斯特鲁德人,被认为是具有审美能力的莫利特人。Keytar helvetica VHS salvia yr,vero magna velit sapiente labore stumptown。纯素fanny pack odio cillum wes anderson 8位可持续牛仔短裤胡须ut DIY道德罪过terry richardson生物柴油。艺术派对现场,tumblr butcher vero sint qui sapiente accusamus纹身回声公园

Etsy混音带旅行者,道德的wes anderson豆腐,然后将mcsweeney的有机lomo retro fanny pack lo-fi农场出售给桌上成衣商。信使包绅士干草叉纹身工艺啤酒,iphone滑板locavore carles etsy salvia banksy连帽衫helvetica。DIY synth PBR banksy讽刺。紧身裤绅士鱿鱼8位cred干草叉。Williamsburg banh mi无麸质,carles pitchfork生物柴油修复etsy retro mlkshk副博客。Scenester cred你可能没听说过,乙烯基工艺啤酒博客stumptown。干草叉可持续豆腐合成厂

信托基金seitan活版、keytar raw denim keffiyeh etsy艺术派对之前,他们出售了master cleanse无麸质鱿鱼scenester freegan cosby毛衣。范妮·帕克波特兰赛坦DIY,艺术派对locavore wolf陈词滥调high life echo park Austin。Cred乙烯基keffiyeh DIY salvia PBR,banh mi在出售农场至餐桌VHS病毒locavore cosby毛衣之前。Lomo wolf病毒,胡子成衣雷霆猫keffiyeh craft beer marfa道德。沃尔夫·萨尔维亚·弗里根,凯菲耶·埃科公园素食主义者

看看:。您将发现一个使用带有下拉列表的选项卡的示例。现在您使用的是btn组而不是选项卡

您可以使用tabs javascript插件中的
data toggle=“tab”
。这个插件需要一些与当前结构不同的html结构。另请阅读:这将显示选项卡也有一个类
.nav justified

因此,请使用以下内容替换您的btn组以解决您的问题:

<ul class="nav nav-tabs nav-justified" id="myTab">
        <li class=""><a data-toggle="tab" href="#home">Home</a></li>
        <li class=""><a data-toggle="tab" href="#profile">Profile</a></li>
        <li class="dropdown active">
          <a data-toggle="dropdown" class="dropdown-toggle" id="myTabDrop1" href="#">Dropdown <b class="caret"></b></a>
          <ul aria-labelledby="myTabDrop1" role="menu" class="dropdown-menu">
            <li class="active"><a data-toggle="tab" tabindex="-1" href="#dropdown1">@fat</a></li>
            <li class=""><a data-toggle="tab" tabindex="-1" href="#dropdown2">@mdo</a></li>
          </ul>
        </li>
</ul>
      <div class="tab-content" id="myTabContent">
        <div id="home" class="tab-pane fade">
          <p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</p>
        </div>
        <div id="profile" class="tab-pane fade">
          <p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p>
        </div>
        <div id="dropdown1" class="tab-pane fade active in">
          <p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.</p>
        </div>
        <div id="dropdown2" class="tab-pane fade">
          <p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.</p>
        </div>
生料牛仔布你可能没听说过,奥斯汀牛仔短裤。雀巢豆腐阿利夸,复古合成大师清洗。威廉斯堡卡尔斯素食者赫尔维蒂卡的胡子陈词滥调。Reprehenderit butcher retro keffiyeh dreamcatcher synth。Cosby毛衣eu banh mi,qui irure terry richardson前鱿鱼。salvia cillum iphone上的Aliquip placeat。Seitan aliquip quis羊毛衫美国服装,屠夫voluptate nisi qui

食品卡车修理工,accusamus mcsweeney的marfa nulla单一来源咖啡鱿鱼。实习+1 labore velit,blog服装PBR紧身裤下一级wes anderson artisan four loko农场到餐桌工艺啤酒花呢。Qui photo booth活版印刷,commodo enim craft beer mlkshk aliquip jean短裤ullamco ad乙烯基纤毛PBR。有机诺斯特鲁德人,被认为是具有审美能力的莫利特人。凯塔赫尔维蒂卡酒店