cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div id="tabsContainer">
  <h1>Simple jQuery Tabs</h1>
  <header class="tabs-nav">
    <ul>
      <li class="active"><a href="#tab1">Tab One</a></li>
      <li><a href="#tab2">Tab Two</a></li>
      <li><a href="#tab3">Tab Three</a></li>
      <li><a href="#tab4">Tab Four</a></li>
    </ul>
  </header>

  <section class="tabs-content">
    <div id="tab1">
      <h3>This is tab 1</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium vel saepe optio, delectus excepturi rerum explicabo necessitatibus quae odio, quia placeat in doloribus eaque, quod sed quam reprehenderit perferendis impedit.</p>

      <p>Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum
        qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
    </div>

    <div id="tab2">
      <h3>Call of duty: Modern warfare 2</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo rem facere ut labore, debitis libero quam cumque natus officia repudiandae nemo laboriosam sint neque eos earum modi, vero odit laudantium.</p>
      <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia
        voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius
        modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.</p>
    </div>

    <div id="tab3">
      <h3>This is tab 3</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi debitis sit, magni amet ipsum numquam eaque vero dolore cum ipsam doloremque deleniti eos! Maiores praesentium voluptates quos dolor commodi, expedita.</p>
    </div>

    <div id="tab4">
      <h3>This is tab 4</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas nobis eos, autem fugiat? Est laudantium obcaecati earum officia, quod quos et quis officiis. Odit consequatur cupiditate optio esse ipsa, eveniet.</p>
    </div>
  </section>
</div>
            
          
!
            
              body {
  font-family: 'Gudea', Arial, Helvetica, sans-serif;
  font-size: 14px;
  background: #e6e6e6
}

a {
  text-decoration: none;
}

/* Tabs Nav styles*/

#tabsContainer {
  padding: 20px;
}

.tabs-nav ul {
  margin: 0;
  padding: 0;
}

.tabs-nav li {
  display: inline-block;
  background: #34495E;
  border-width: 1px 1px 0 1px;
  border-style: solid;
  border-color: #34495E;
  margin-right: 5px;
}

.tabs-nav a {
  display: block;
  padding: 10px 15px;
  font-weight: bold;
  color: #fff;
}
/* Tabs Active state styles*/

.tabs-nav li.active {
  background: #FFF;
}

.tabs-nav li.active a {
  color: inherit;
}
/*Tabs Content styles*/

.tabs-content {
  border: 1px solid #34495E;
  padding: 10px;
  background: #FFF;
  margin-top: -1px;
  overflow: hidden;
}

.tabs-content IMG {
  margin-right: 10px;
}
/* Hide All the content divs EXCEPT the first one */

.tabs-content div:not(:first-child) {
  display: none;
}
            
          
!
            
              $(function() {
  $('.tabs-nav a').click(function() {

    //Check if the tabs menu has active class
    $('.tabs-nav li').removeClass('active');
    $(this).parent().addClass('active');

    // Display active tab
    var currentTab = $(this).attr('href');
    $('.tabs-content div').hide();
    $(currentTab).show();

    return false;
  });
});
            
          
!
999px
Loading ..................

Console