JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
<nav>
<ul>
<li><a href="#0">Home</a></li>
<li><a href="#0">About</a></li>
<li>
<a href="#0">Clients</a>
<ul>
<li>
<a href="#0">Burger King</a>
<ul>
<li><a href="#0">Project 1</a></li>
<li><a href="#0">Project 2</a></li>
<li><a href="#0">Project 3</a></li>
</ul>
</li>
<li>
<a href="#0">Southwest Airlines</a>
<ul>
<li><a href="#0">Project 1</a></li>
<li><a href="#0">Project 2</a></li>
<li><a href="#0">Project 3</a></li>
</ul>
</li>
<li>
<a href="#0">Levi Strauss</a>
<ul>
<li><a href="#0">Project 1</a></li>
<li><a href="#0">Project 2</a></li>
<li><a href="#0">Project 3</a></li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#0">Services</a>
<ul>
<li>
<a href="#0">Print Design</a>
<ul>
<li><a href="#0">Subservice 1</a></li>
<li><a href="#0">Subservice 2</a></li>
<li><a href="#0">Subservice 3</a></li>
</ul>
</li>
<li>
<a href="#0">Web Design</a>
<ul>
<li><a href="#0">Subservice 1</a></li>
<li><a href="#0">Subservice 2</a></li>
<li><a href="#0">Subservice 3</a></li>
</ul>
</li>
<li>
<a href="#0">Mobile App Development</a>
<ul>
<li><a href="#0">Subservice 1</a></li>
<li><a href="#0">Subservice 2</a></li>
<li><a href="#0">Subservice 3</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#0">Contact</a></li>
</ul>
</nav>
<div id="content">
<h1>Sidebar Navigation</h1>
<h2>A Codepen Challenge</h2>
<p>This Pen was made for the Navigation Challenge on Codepen in August 2019.</p>
<p>Hover on the Burger-Menu to open the sidebar.</p>
<p>Feel free to use this small example of a Sidebar Navigation in your project.</p>
</div>
/* Sidebar */
/* Main-Wrapper */
nav {
position: fixed;
width: 150px;
left: -150px;
top: 0;
bottom: 0;
background-color: rgba( 0, 0, 0, .9 );
padding: 15px 0;
transition: left 1s ease-in .5s;
}
nav:after {
content: "\f0c9";
font-family: "FontAwesome";
font-weight: 400;
font-style: normal;
text-decoration: inherit;
color: #ffffff;
position: absolute;
left: 100%;
top: 0;
padding: 15px;
background-color: rgba( 0, 0, 0, .9 );
border-bottom-right-radius: 5px;
cursor: pointer;
}
nav:hover {
left: 0;
transition: left 1s ease-in 0s;
}
nav:hover:after {
content: "\f00d";
}
/* Global Styles */
nav ul a {
color: #ffffff;
text-decoration: none;
padding-left: 25px;
display: block;
}
nav ul a:after {
content: "\f054";
font-family: "FontAwesome";
display: block;
position: absolute;
left: 15px;
top: 13px;
font-size: 12px;
}
nav ul {
list-style-type: none;
padding: 0;
margin: 0;
}
nav ul li {
position: relative;
}
nav ul li a {
padding: 10px 5px;
padding-left: 30px;
}
nav ul li:hover {
background-color: rgba( 0, 150, 255, 1 );
}
/* First-Level Navigation */
nav > ul {
margin-top: 32px;
}
/* Multi-Level Navigation */
nav ul li > ul {
position: absolute;
background-color: rgba( 0, 0, 0, .9 );
width: 100%;
top: 1999px;
left: 100%;
transition: top .5s;
}
nav ul li > ul li {
min-width: 120px;
}
nav ul li:hover > ul,
nav ul li > ul:hover {
top: 0%;
}
/* Alternative Style */
/* Looks good, but a bit unhandy */
/*
nav ul li > ul {
position: unset;
background-color: transparent;
margin-left: 10px;
max-height: 0;
transition: max-height .5s;
overflow: hidden;
}
nav ul li:hover > ul {
max-height: 999px;
overflow: visible;
}
nav ul li {
background-color: rgba( 0, 0, 0, .4 );
}
nav ul li:hover {
background-color: rgba( 0, 150, 255, .4 );
}
/**/
/* Other CSS */
body {
font-family: Arial, sans-serif;
}
#content {
text-align: center;
margin: 100px 0;
}
h1 {
margin-bottom: 10px;
}
h2 {
margin-top: 10px;
}
p {
margin: 0 0 10px 0;
}
Also see: Tab Triggers