css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              

<!--dummy content above-->
<ul class="tabs">
  <li class="active" rel="tab1">Molestie lobortis</li>
  <li rel="tab2">Venenatis</li>
  <li rel="tab3">Ipsum</li>
  <li rel="tab4">Rhoncus dolor nunc</li>
</ul>
<div class="tab_container">
  <h3 class="d_active tab-accordion_heading" rel="tab1">Molestie lobortis</h3>
  <div id="tab1" class="tab_content">
    <p>Lorem ipsum non pellentesque lacinia ullamcorper faucibus eu quisque, ut odio nisi aptent proin dictumst lorem tincidunt, accumsan nec habitasse arcu nisl lacus gravida odio elementum quis consectetur vehicula egestas.</p>
  </div>
  <!-- #tab1 -->
  <h3 class="tab-accordion_heading" rel="tab2">Venenatis</h3>
  <div id="tab2" class="tab_content">
    <p>Dui sociosqu vitae varius nulla habitasse inceptos pharetra feugiat curabitur, nibh molestie est semper mattis malesuada viverra auctor, duis pulvinar quam diam scelerisque ut nullam condimentum ut per conubia feugiat ultricies tristique dictum.

</p>
  </div>
  <!-- #tab2 -->
  <h3 class="tab-accordion_heading" rel="tab3">Ipsum</h3>
  <div id="tab3" class="tab_content">
    <p>Morbi cursus dapibus ut donec commodo consequat arcu turpis hendrerit luctus nulla aliquam tempor diam massa faucibus vitae vehicula, ultricies volutpat nullam phasellus dui auctor senectus morbi tellus potenti iaculis bibendum ipsum sodales non.

</p>
  </div>
  <!-- #tab3 -->
  <h3 class="tab-accordion_heading" rel="tab4">Rhoncus dolor nunc</h3>
  <div id="tab4" class="tab_content">
    <p>Per ligula mollis vulputate tortor urna platea non maecenas fames, maecenas ante senectus suspendisse ultrices aptent torquent laoreet scelerisque ut integer arcu magna ultricies mollis.

</p>
  </div>
  <!-- #tab4 --> 
</div>
</div>


            
          
!
            
              @import "compass/css3";

body{
padding:50px;
font-size:12px;
}

//customise here
$border-color              :#ccc;
$tab-hover-bg              :#e5e5e5;
$tab-head-color            :#999;
$accorion-header-bg        :#fff;
$accorion-header-bg-active :#e5e5e5;

ul.tabs {
	margin: 0;
	padding: 0;
	float: left;
	list-style: none;
	height: 32px;
	border-bottom: 1px solid $border-color;
	width: 100%;
  li {
      float: left;
      margin: 0;
      cursor: pointer;
      padding: 0px 20px;
      height: 32px;
      line-height: 31px;
      color:$tab-head-color;
      border-bottom: 0px;
      overflow: hidden;
      position: relative;
      border-top-left-radius:5px;
      border-top-right-radius:5px;
      &:hover {
        background-color: $tab-hover-bg;
        color:#000;
      }
      &.active {
        border:1px solid $border-color;
        background-color: #fff;
        color: #333;
        border-bottom: 1px solid #fff;
        display: block;
      }
    }
}

.tab_container {
	border: 1px solid $border-color;
	border-top:0px;
	clear: both;
	float: left;
	width: 100%;
}

.tab_content {
	padding: 20px;
	display: none;
}

//accordion styles

.tab-accordion_heading { display: none; }

//mediaquery for screens smaller than ipad
@media screen and (max-width: 767px) {
	.tabs {
		display: none;
	}
	.tab-accordion_heading {
    background-color: $accorion-header-bg;
		border-top: 1px solid $border-color;
		margin: 0;
		padding: 10px 20px;
		display: block;
		cursor: pointer;
    font-weight:normal;
    color:#666;
    font-size:1em;
	}
	.d_active {
		background-color: $accorion-header-bg-active ;
		color: #000;
	}
}
            
          
!
            
              
    $(".tab_content").hide();
 $(".tab_content:first").show();

//tab mode

    $("ul.tabs li").click(function() {
		
      $(".tab_content").hide();
      var activeTab = $(this).attr("rel"); 
      $("#"+activeTab).fadeIn();		
      $("ul.tabs li").removeClass("active");
      $(this).addClass("active");

      $(".tab-accordion_heading").removeClass("d_active");
      $(".tab-accordion_heading[rel^='"+activeTab+"']").addClass("d_active");
      
      
 		  target= $('.tabs');
         $('html,body').animate({
           scrollTop: target.offset().top
         }, 1000);
	  
    });

	/* acoordion mode */

	$(".tab-accordion_heading").click(function() {
      
      $(".tab_content").hide();
      var d_activeTab = $(this).attr("rel"); 
      $("#"+d_activeTab).fadeIn();
    
	   $(".tab-accordion_heading").removeClass("d_active");
      $(this).addClass("d_active");
	  
      $("ul.tabs li").removeClass("active");
      $("ul.tabs li[rel^='"+d_activeTab+"']").addClass("active");
       
    if ( $( this ).hasClass( "d_active" ) ) {
             $(this).removeClass("d_active");
             $("#"+d_activeTab).fadeIn();
    }
    

    });
	
		
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console