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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <!-- Source: http://thecodeplayer.com/experiment/vertical-accordion-menu-using-jquery-css3/3 -->

<head>
		<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Nunito">
		<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>

<body style="background:#e5e5e5;">

<div id="accordian">
		<ul>
				<li>
						<h3><a href="#"><i class="fa fa-lg fa-tachometer"></i>Dashboard</a></h3>
						<ul>
								<li><a href="#">Reports</a></li>
								<li><a href="#">Search</a></li>
								<li><a href="#">Graphs</a></li>
								<li><a href="#">Settings</a></li>
						</ul>
				</li>
				<li class="active">
						<h3><a href="#"><i class="fa fa-lg fa-tasks"></i>Tasks (active)</a></h3>
						<ul>
								<li><a href="#">Today's tasks</a></li>
								<li class="active">
										<a href="#">DrillDown (active)</a>
										<ul>
												<li><a href="#">Today's tasks</a></li>
												<li><a href="#">Urgent</a></li>
												<li>
														<a href="#">Overdues</a>
														<ul>
																<li><a href="#">Today's tasks</a></li>
																<li><a href="#">Urgent</a></li>
																<li><a href="#">Overdues</a></li>
																<li><a href="#">Recurring</a></li>
																<li><a href="#">Settings</a></li>
														</ul>
												</li>
												<li><a href="#">Recurring</a></li>
												<li><a href="#">Settings</a></li>
										</ul>
								</li>
								<li>
										<a href="#">Overdues</a>
										<ul>
												<li><a href="#">Today's tasks</a></li>
												<li><a href="#">Urgent</a></li>
												<li><a href="#">Overdues</a></li>
												<li><a href="#">Recurring</a></li>
												<li><a href="#">Settings</a></li>
										</ul>
								</li>
								<li><a href="#">Recurring</a></li>
								<li><a href="#">Settings</a></li>
						</ul>
				</li>
				<li>
						<h3><a href="#"><i class="fa fa-lg fa-calendar"></i></span>Calendar</a></h3>
						<ul>
								<li><a href="#">Current Month</a></li>
								<li><a href="#">Current Week</a></li>
								<li><a href="#">Previous Month</a></li>
								<li><a href="#">Previous Week</a></li>
								<li><a href="#">Next Month</a></li>
								<li><a href="#">Next Week</a></li>
								<li><a href="#">Team Calendar</a></li>
								<li><a href="#">Private Calendar</a></li>
								<li><a href="#">Settings</a></li>
						</ul>
				</li>
				<li>
						<h3><a href="#"><i class="fa fa-lg fa-heart"></i>Favourites</a></h3>
						<ul>
								<li><a href="#">Global favs</a></li>
								<li><a href="#">My favs</a></li>
								<li><a href="#">Team favs</a></li>
								<li><a href="#">Settings</a></li>
						</ul>
				</li>
		</ul>
</div>

</body>
              
            
!

CSS

              
                * {
		margin: 0;
		padding: 0;
}

body {
		background: #4EB889;
		font-family: Nunito, arial, verdana;
}

#accordian {
		background: #004050;
		width: 250px;
		margin: 50px auto 0 auto;
		color: white;
		box-shadow: 0 5px 15px 1px rgba(0, 0, 0, 0.6), 0 0 200px 1px rgba(255, 255, 255, 0.5);
}

#accordian h3 {
		background: #003040;
		background: linear-gradient(#003040, #002535);
}

#accordian h3 a {
		padding: 0 10px;
		font-size: 12px;
		line-height: 34px;
		display: block;
		color: white;
		text-decoration: none;
}

#accordian h3:hover {
		text-shadow: 0 0 1px rgba(255, 255, 255, 0.7);
}

i {
		margin-right: 10px;
}

#accordian li {
		list-style-type: none;
}

#accordian ul ul li a,
#accordian h4 {
		color: white;
		text-decoration: none;
		font-size: 11px;
		line-height: 27px;
		display: block;
		padding: 0 15px;
		transition: all 0.15s;
		position: relative;
}

#accordian ul ul li a:hover {
		background: #003545;
		border-left: 5px solid lightgreen;
}

#accordian ul ul {
		display: none;
}

#accordian li.active>ul {
		display: block;
}

#accordian ul ul ul {
		margin-left: 15px;
		border-left: 1px dotted rgba(0, 0, 0, 0.5);
}

#accordian a:not(:only-child):after {
		content: "\f104";
		font-family: fontawesome;
		position: absolute;
		right: 10px;
		top: 0;
		font-size: 14px;
}

#accordian .active>a:not(:only-child):after {
		content: "\f107";
}
              
            
!

JS

              
                $(document).ready(function() {
		$("#accordian a").click(function() {
				var link = $(this);
				var closest_ul = link.closest("ul");
				var parallel_active_links = closest_ul.find(".active")
				var closest_li = link.closest("li");
				var link_status = closest_li.hasClass("active");
				var count = 0;

				closest_ul.find("ul").slideUp(function() {
						if (++count == closest_ul.find("ul").length)
								parallel_active_links.removeClass("active");
				});

				if (!link_status) {
						closest_li.children("ul").slideDown();
						closest_li.addClass("active");
				}
		})
})
              
            
!
999px

Console