Twitter bootstrap tabs example

Twitter bootstrap tabs example

Twitter bootstrap tabs example

Twitter bootstrap JavaScript tab tab is a wonderful toll to organize your site with content. You can use it on your site and organize your content according to your choice. It’s a smart way to show your content op group. You can even use drop down menu on a tab.


Here is a example :

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.

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.


The HTML Markup of a tab :

 
<ul class="nav nav-tabs" id="myTab">
  <li class="active"><a href="#home">Home</a></li>
  <li><a href="#profile">Profile</a></li>
  <li><a href="#messages">Messages</a></li>
  <li><a href="#settings">Settings</a></li>
</ul>

<div class="tab-content">
  <div class="tab-pane active" id="home">Your Home tab content here </div>
  <div class="tab-pane" id="profile">Your Profile tab content here </div>
  <div class="tab-pane" id="messages"> Your Messages tab content here </div>
  <div class="tab-pane" id="settings">Your Settings tab content here</div>
</div>

<script>
  $(function () {
    $('#myTab a:last').tab('show')
  })
</script>

  • Sid Hernandez

    are you sure that script is correct? it didnt work for me. it stays on the last tab and then doesnt change.

    • Michael J. Buehler

      That’s exactly what that script will do — activate the last tab…

      Try something more like this:

      $(document).ready(function(){
      $(“#myTab li”).bind(“click”,function(){
      // clear all of the “active” states
      $(“#myTab li”).removeClass(“active”);
      // activate the selected tab
      $(this).addClass(“active”);
      // show the tab content
      $(this).children().tab(‘show’);
      });

      The script in the post is also missing semicolons at the end of each statement, which is bad form, as well being inline. You should put the above script right before the last tag at end of your page. Additionally, it is inside the $(document).ready event to make sure it doesn’t run before the page has been rendered.

  • Vijay Palaniappan

    $(document).ready(function () {
    $(“.nav-tabs a”).click(function () {
    $(this).tab(‘show’);
    });
    });

    Try this script, it works




row end -->