Bootstrap活动列表/文本对齐

时间:2014-12-07 08:25:39

标签: php html css twitter-bootstrap

我今天早些时候开始使用bootstrap,我遇到了一些问题,试图找到一个活动的标签,以及文本的对齐方式。

我想要做的是当它在当前部分时突出显示选项卡,由于某种原因,只有第一个选项卡Overview,即使切换到另一个选项卡,也会保持突出显示。

接下来我想知道如何调整它以便文本在标签旁边而不是在结尾处或在所有标签之后开始。任何帮助将不胜感激!

<div><div class="jumbotron">
  <div class="tabBars" style="padding-left: 10px;">
    <div class = "list-group">
    <a data-toggle="tab" class="list-group-item active" href="#overview">Overview</a>
    <a data-toggle="tab" class="list-group-item" href="#classes">Classes</a>
    <a data-toggle="tab" class="list-group-item" href="#features">Features</a>
    <a data-toggle="tab" class="list-group-item" href="#ranks">Ranks</a>
    <a data-toggle="tab" class="list-group-item" href="#faq">F.A.Q</a>
    </div>
  </div>
    <div class="tab-content mainArea">
        <div id="overview" class="tab-pane fade in active">
            <h3>Overview</h3>
            <p>Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui. 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.</p>
        </div>
        <div id="classes" class="tab-pane fade">
            <h3>Classes</h3>
            <p>Vestibulum nec erat eu nulla rhoncus fringilla ut non neque. Vivamus nibh urna, ornare id gravida ut, mollis a magna. Aliquam porttitor condimentum nisi, eu viverra ipsum porta ut. Nam hendrerit bibendum turpis, sed molestie mi fermentum id. Aenean volutpat velit sem. Sed consequat ante in rutrum convallis. Nunc facilisis leo at faucibus adipiscing.</p>
        </div>
        <div id="features" class="tab-pane fade">
            <h3>Features</h3>
            <p>WInteger convallis, nulla in sollicitudin placerat, ligula enim auctor lectus, in mollis diam dolor at lorem. Sed bibendum nibh sit amet dictum feugiat. Vivamus arcu sem, cursus a feugiat ut, iaculis at erat. Donec vehicula at ligula vitae venenatis. Sed nunc nulla, vehicula non porttitor in, pharetra et dolor. Fusce nec velit velit. Pellentesque consectetur eros.</p>
        </div>
        <div id="ranks" class="tab-pane fade">
            <h3>Ranks</h3>
            <p>Donec vel placerat quam, ut euismod risus. Sed a mi suscipit, elementum sem a, hendrerit velit. Donec at erat magna. Sed dignissim orci nec eleifend egestas. Donec eget mi consequat massa vestibulum laoreet. Mauris et ultrices nulla, malesuada volutpat ante. Fusce ut orci lorem. Donec molestie libero in tempus imperdiet. Cum sociis natoque penatibus et magnis.</p>
        </div>
    </div>
</div></div>

目前输出

http://i.stack.imgur.com/WLF0J.png(无法发布图片)

正如您所看到的,我打开了“课程”选项卡,但仍然会突出显示“概述”选项卡。文本也从下面开始,我试图让它在标签旁边开始。

1 个答案:

答案 0 :(得分:0)

您可以包含此jQuery脚本,将选定的标签设置为active

<强>脚本:

 $('.tabBars > div > a').click( function() {
    $('.tabBars > div > .active').removeClass('active');
    $(this).addClass('active');
} );

这是一个有效的 Fiddle