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 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.

Quick-add: + add another resource

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.

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.

            
              <!--Pattern HTML-->
  <div id="pattern" class="pattern">
    <!--Begin Pattern HTML-->
    <h3 id="tab1" class="tab accordian" aria-controls="panel1" role="tab" tabindex="0">Section 1</h3>

  <div id="panel1" class="panel accordian" aria-labeledby="tab1" role="tabpanel">
  	<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
	</div>

	<h3 id="tab2" class="tab accordian" aria-controls="panel2" role="tab" tabindex="-1">Section 2</h3>
	<div id="panel2" class="panel accordian" aria-labeledby="tab2" role="tabpanel">
		<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
	</div>

	<h3 id="tab3" class="tab accordian" aria-controls="panel3" role="tab" tabindex="-1">Section 3</h3>
	<div id="panel3" class="panel accordian" aria-labeledby="tab3" role="tabpanel">
		<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
	</div>

	<h3 id="tab4" class="tab accordian" aria-controls="panel4" role="tab" tabindex="-1">Section 4</h3>
	<div id="panel4" class="panel accordian" aria-labeledby="tab4" role="tabpanel">
	 	<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
	</div>

	</div>
	<!--End Pattern HTML-->
	
	<div class="container">	
		<section class="pattern-description">
			<h1>Accordion to Full</h1>
      <p>Small screens are presented with a collapsed accordion of the sections, and when enough screen space becomes available the sections expand and show the full content. </p>
      <h2>Considerations</h2>
      <ul>
        <li>Use proper ARIA roles</li>
        <li>Only hide panel content when Javascript becomes available in order to keep content accessible for users with poor or no javascript support.</li>
        <li>Use clear labels (typically a plus sign or downward caret) to indicate accordions are interactive</li>
      </ul>
      <h2>Resources</h2>
      <ul>
        <li><a href="http://test.cita.uiuc.edu/aria/tabpanel/tabpanel2.php">ARIA Tabpanel example</a></li>
      </ul>
		</section>
		<footer role="contentinfo">   
			<div>
				<nav id="menu">
					<a href="https://bradfrost.github.com/this-is-responsive/patterns.html">&larr;More Responsive Patterns</a>
				</nav>
			</div>
		</footer>
	</div>
            
          
!
            
              .tab {
  padding: 1em;
  margin: 0;
  position: relative;
  cursor: pointer;
  outline: 0;
}
.tab:after {
    	content: '+';
			position: absolute;
			top: 0;
			right: 0;
			display: block;
			font-size: 1.5em;
			padding: 0.5em;
}
.tab.active {
  background: rgba(0,0,0,0.3);
}
.tab.active:after {
   content: '-'; 
}

.panel { 
  overflow: hidden;
}
.js .panel {
  max-height: 0;
  -webkit-transition: max-height 0.3s ease-out;
  -moz-transition: max-height 0.3s ease-out;
  -ms-transition: max-height 0.3s ease-out;
  -o-transition: max-height 0.3s ease-out;
  transition: max-height 0.3s ease-out;
}
.js .panel.active {
  max-height: 30em;
}
.panel p {
  padding: 1em;
}
.panel p:last-child {
   margin: 0; 
}

/* Where it makes sense to display the full content */
@media all and (min-width:50em) {
  .tab {
    cursor: default;
  } 
  .tab.active {
     background: none; 
  }
  .tab:after, .tab.active:after {
     content: ""; 
  }
  
  .js .panel, .js .panel.active {
     max-height: none; 
  }
}
            
          
!
            
              $(document).ready(function() {
      $('body').addClass('js');
  	  var $tab = $('.tab');
  
		$tab.on("click", function(e){
      e.preventDefault();
      var $this = $(this);
      $this.toggleClass('active');
      $this.next('.panel').toggleClass('active');
    });
});
            
          
!
999px
Loading ..................

Console