Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                    <div class="content">
      <h1>jQuery (UI-less) Accordion</h1> 
	    <div class="cat">
		    <ul class="accordion">
				<li>
					<h2>Title 01</h2>
		    		<p class="item"><a href="#">Purus Ornare Pellentesque Egestas</a></p>
					<div>
						<p>Etiam porta sem malesuada magna mollis euismod. Vestibulum id ligula porta felis euismod semper. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
					</div>
				</li>
				<li>
					<p class="item"><a href="#">Ipsum Fusce</a></p>
					<div>
						<p>Etiam porta sem malesuada magna mollis euismod. Vestibulum id ligula porta felis euismod semper. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
					</div>
				</li>
			</ul>

		</div><!--.pub-cat-->
		
		<div class="cat">
		    <ul class="accordion">
				<li>
					<h2>Title 02</h2>
		    		<p class="item"><a href="#">Justo Vestibulum</a></p>
					<div>
						<p>Etiam porta sem malesuada magna mollis euismod. Vestibulum id ligula porta felis euismod semper. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
					</div>
				</li>
				<li>
					<p class="item"><a href="#">Fringilla Venenatis Sollicitudin</a></p>
					<div>
						<p>Etiam porta sem malesuada magna mollis euismod. Vestibulum id ligula porta felis euismod semper. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
					</div>
				</li>
			</ul>

		</div><!--.pub-cat-->
		
		<div class="cat">
		    <ul class="accordion">
				<li>
					<h2>Title 03</h2>
		    		<p class="item"><a href="#">Sollicitudin Elit Amet</a></p>
					<div>
						<p>Etiam porta sem malesuada magna mollis euismod. Vestibulum id ligula porta felis euismod semper. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
					</div>
				</li>
				<li>
					<p class="item"><a href="#">Porta Consectetur Purus</a></p>
					<div>
						<p>Etiam porta sem malesuada magna mollis euismod. Vestibulum id ligula porta felis euismod semper. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
					</div>
				</li>
			</ul>

		</div><!--.pub-cat-->
		
		<div class="cat">
		    <ul class="accordion">
				<li>
					<h2>Title 04</h2>
		    		<p class="item"><a href="#">Dapibus Ligula Pellentesque Ipsum</a></p>
					<div>
						<p>Etiam porta sem malesuada magna mollis euismod. Vestibulum id ligula porta felis euismod semper. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
					</div>
				</li>
				<li>
					<p class="item"><a href="#">Ultricies Venenatis Pharetra Lorem Nibh</a></p>
					<div>
						<p>Etiam porta sem malesuada magna mollis euismod. Vestibulum id ligula porta felis euismod semper. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
					</div>
				</li>
			</ul>

		</div><!--.pub-cat-->
		
		<div class="cat">
		    <ul class="accordion">
				<li>
					<h2>Title 05</h2>
		    		<p class="item"><a href="#">Ridiculus Mattis Ullamcorper</a></p>
					<div>
						<p>Etiam porta sem malesuada magna mollis euismod. Vestibulum id ligula porta felis euismod semper. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
					</div>
				</li>
				<li>
					<p class="item"><a href="#">Etiam Fermentum Cursus</a></p>
					<div>
						<p>Etiam porta sem malesuada magna mollis euismod. Vestibulum id ligula porta felis euismod semper. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo.</p>
					</div>
				</li>
			</ul>

		</div><!--.pub-cat-->



 
    </div><!--.content-->
              
            
!

CSS

              
                *{
  font-family: "Helvetica Neue", Helvetica, sans-serif;
  background: #F36C4F;
  color: #fff;
}
h1{
  text-align: center;
  color: #fff;
  font-size: 3em;
  width: 100%;
  font-weight: 100
}
.content{
  width: 70%;
  margin: 0 auto;
}
.cat{
  width: 100%;
  padding-bottom: 1em;
}
ul li{
  list-style: none;
}
h2{
  line-height: 15px;
  font-weight: 900;
}
.item{
  line-height: 5px;
}
.item a{
  color: #000;
  text-decoration: none;
  font-weight: 700;
}

              
            
!

JS

              
                            ///DOC READY FUNCTIONS
jQuery( document ).ready(function( $ ) {
 
	if ( jQuery( '.accordion' )[0] ){
 
		jQuery( '.accordion' ).find( '.item' ).click( function( e ){ //Click function to toggle extending lists
 
			e.preventDefault();		
 
			jQuery( this ).next().slideToggle( 'fast' ).css( 'zoom', '1' ); //Find the next element after the clicked element	
                        jQuery(".accordion > li > div").not($(this).next()).slideUp( 'fast' ).css( 'zoom', '1' );
			jQuery( this ).parent( 'li' ).toggleClass( 'collapse' ); //Add a class for styling
 
		} );
 
		jQuery( '.accordion > li' ).each( function( $ ){ //Function initially hide lists with the override class of "extended"
 
			if ( !jQuery( this ).hasClass( 'extended' ) ){
 
				jQuery( this ).find( 'div' ).slideUp( 'fast' ).css( 'zoom', '1' ); //hide all lists without a parent of "extended"
				jQuery( this ).toggleClass( 'collapse' ); //Add a class for styling
 
			}
 
		} );
 
 
	}
 
} );
              
            
!
999px

Console