cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-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 class="accordion">
	<h4 class="accordion-toggle active"> This is an accordion <i class="fa fa-chevron-down"></i></h4>
	<div class="accordion-content default ">
		<p>TThis is a simple accordion implementation, that's uses minimal markup and roughly 8 lines of jQuery.  It can be easily hacked to use different behavior.  Chevrons are font awesome but easily replaced with anything.
		</p>
	</div>
	<h4 class="accordion-toggle ">Another Tab <i class="fa fa-chevron-down"></i></h4>
	<div class="accordion-content">
		<p>This is a play on an ultra lightweight accordion menu.</p>
	</div>

	<h4 class="accordion-toggle">News Releases <i class="fa fa-chevron-down"></i></h4>
	<div class="accordion-content" >
		<p>Vivamus facilisisnibh scelerisque laoreet.</p>
	</div>
</div>
            
          
!
            
              //Used on contact page
$orange: #f8580a;
.accordion {
	background-color: $orange;
	margin-top: 20px;
	margin-bottom:20px;
	i {
		position: absolute;
		right: 10px;
		&:before {

			display: inline-block;
			-ms-transform-origin: 50% 35%;
			-webkit-transform-origin: 50% 35%;
			-moz-transform-origin: 50% 35%;
			transform-origin: 50% 35%;
			-webkit-transition-timing-function: ease-in-out; /* Safari and Chrome */
			transition-timing-function: ease-in-out;
			-webkit-transform-style: preserve-3d;
			-moz-transform-style: preserve-3d;
			transform-style: preserve-3d;
			-webkit-transition: all 0.3s;
			-moz-transition: all 0.3s;
			transition: all 0.3s;
			 transform: rotateZ(0deg);
			 transform-origin: 50% 50%;
			-moz-transform: rotateZ(0deg);
			-webkit-transform: rotateZ(0deg);
			-o-transform: rotateZ(0deg);
			-ms-transform: rotateZ(0deg);
		}
	}
	h4 {
		color: white;
		position: relative;
		background-color: $orange;
		padding: 10px;
		border-bottom: 1px solid #444;
		margin:0;
		line-height: 1em;
		font-size: 16px;
		text-transform: uppercase;
		&:hover {
			background-color: lighten($orange, 20%)
		}
	}
	h4.active {
		background-color: $orange;
		i:before {
			 transform: rotateZ(180deg);
            -moz-transform: rotateZ(180deg);
            -webkit-transform: rotateZ(180deg);
            -o-transform: rotateZ(180deg);
            -ms-transform: rotateZ(180deg);
		}
	}
}

.accordion-toggle {
	cursor: pointer;
}

.accordion-content {
	padding: 14px;
	display: none;
	background-color: white;
	&.default {
		display: block;
	}
}
body {
	background: #444;
}
            
          
!
            
              (function(jQuery) {
	"use strict";
	var Engine;
	jQuery(document).ready(function() {
		Engine = {
			ui: {
				accordion: function() {

					/*==============================
					   Accordion functionality f
					===============================*/

					$('.accordion').find('.accordion-toggle').click(function() {
						//Expand or collapse this panel
						$(this).next().slideToggle('fast');
						if (!$(this).hasClass("active")) {
							$('.accordion h4').removeClass('active');
							$(this).addClass('active');
						} else {
							$('.accordion h4').removeClass('active');
						}
						$(".accordion-content").not($(this).next()).slideUp('fast');

					});
				}
			} // ui
		}; // Engine
		Engine.ui.accordion();
	});
}(jQuery));
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console