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.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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><span class="hamburger" onclick="openSideNav()">&#9776;</span>
  <p> (Click)</p></div>
 <br class="clear" >
<div class="para"> After you click to open the side nav, if you adjust the page width, it will close under a certain size.</div?
<!-- sliding side navigation
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <!-- The overlay -->
 <!-- Overlay content -->
<div id="slidingSideNav" class="overlay">
  <a href="javascript:void(0)" class="sideClosebtn" onclick="closeSideNav()">&times;</a>
  <div class="side-overlay-content">
  <!-- ACCORDION
    ================================================== -->
	<h1 id="accordion">Accordion Side Nav</h1>
	<aside class="accordion">
		<h1>Category A</h1>
		<div>
			<h2>Sub Category</h2>
			<div>
				<ul>
					<li>
						<a href="#">A Link</a>
					</li>
					<li>
						<a href="#">Another Link</a>
					</li>
				</ul>
			</div>
			<h2>Sub Category</h2>
			<div>
				<ul>
					<li>
						<a href="#">A Link</a>
					</li>
					<li>
						<a href="#">Another Link</a>
					</li>
				</ul>
			</div>
		</div>
		<h1>Category B</h1>
		<div>
			<h2>Sub Category</h2>
			<div>
				<h3>Another Sub Category</h3>
				<div>
					<ul>
						<li>
							<a href="#">A Link</a>
						</li>
						<li>
							<a href="#">Another Link</a>
						</li>
					</ul>
				</div>
				<h3>Another Sub Category</h3>
				<div>
					<ul>
						<li>
							<a href="#">A Link</a>
						</li>
						<li>
							<a href="#">Another Link</a>
						</li>
					</ul>
				</div>
				<h3>Another Sub Category</h3>
				<div>
					<ul>
						<li>
							<a href="#">A Link</a>
						</li>
						<li>
							<a href="#">Yet Another Link</a>
						</li>
					</ul>
				</div>
			</div>
			<h2>Sub Category</h2>
			<div>
				<h3>Another Sub Category</h3>
				<div>
					<ul>
						<li>
							<a href="#">A Link</a>
						</li>
						<li>
							<a href="#">Another Link</a>
						</li>
						<li>
							<a href="#">Yet Another Link</a>
						</li>
					</ul>
				</div>
				<h3>Another Sub Category</h3>
				<div>
					<ul>
						<li>
							<a href="#">A Link</a>
						</li>
						<li>
							<a href="#">Another Link</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<h1>Category C</h1>
		<div>
			<h2>Sub Category</h2>
			<div>
				<ul>
			<li>
							<a href="#">A Link</a>
						</li>
						<li>
							<a href="#">Another Link</a>
						</li>
				</ul>
			</div>
			<h2>Sub Category</h2>
			<div>
				<ul>
				<li>
							<a href="#">A Link</a>
						</li>
						<li>
							<a href="#">Another Link</a>
						</li>
				</ul>
			</div>
			<h2>Sub Category</h2>
			<div>
				<ul>
				<li>
							<a href="#">A Link</a>
						</li>
						<li>
							<a href="#">Another Link</a>
						</li>
						<li>
							<a href="#">Yet Another Link</a>
						</li>
				</ul>
			</div>
		</div>
		<h1>Category D</h1>
		<div>
			<ul>
				<li>
							<a href="#">A Link</a>
						</li>
						<li>
							<a href="#">Another Link</a>
						</li>
			</ul>
		</div>
		<h1>Category E</h1>
		<p>'Tis not so deep as a well, nor so wide as a church-door; but 'tis enough,'twill serve: ask for me to-morrow, and you shall find me a grave man. </p>
	</aside>
  </div>
</div>
            
          
!
            
              /* sliding  vertical navigation
–––––––––––––––––––––––––––––––––––––––––––––––––– */
html {
  font-size: 62.5%; }
	.hamburger {
		 font-size: 4em;
    float: left;
	}
body {font-family:  "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;}
p {float: left;
font-size: 4rem;}
    .clear {
      clear: both;
      display: block;
      overflow: hidden;
      visibility: hidden;
      width: 0;
      height: 0;
    }
.para {
  font-size: 1.5rem;}

#slidingSideNav.overlay {
    height: 100%;
    width: 0%;
}

.overlay { 
  
    position: fixed;
    z-index: 1;
    top: 0;
    left: 0;
    background-color: #262626; /* rgb(0,0,0);*/
   /* background-color: rgba(0,0,0, 0.9);*/
    overflow-y: hidden;
    transition: 0.5s;}

.side-overlay-content {
	 position: relative;
    top: 5%;
    width: 100%;
    margin-top: 3rem;
}

.overlay a {
    padding: 1rem 3rem;
    text-decoration: none;
    font-size: 24px;
    color: #818181;
    display: block;
    transition: 0.3s;
}

.overlay a:hover, .overlay a:focus {
    color: #f1f1f1;
}


.sideClosebtn {
    position: absolute;
    top: 3%;
    right: 5%;
    font-size: 6rem;
}

@media screen and (max-height: 450px) {
  .overlay {
   overflow-y: auto;}
  .overlay a {font-size: 2rem;}
 }
@media only screen and (max-width: 479px) {
	.sideClosebtn {
    right: 2%;
}
}

/*Copyright (c) 2017 by Ryan Bobrowski, Susan Jensen (https://codepen.io/rbobrowski/pen/likvA)*/

* {
  margin: 0; padding: 0;
}

.accordion h1, h2, h3, h4{
  cursor: pointer;
  	margin: 0;
	padding: 0;
}

/* percentages listed next to the background colors are from the chart here: https://www.w3schools.com/colors/colors_picker.asp  Listing them this way should make it relatively easy to swap them out for a different base color (hue), while maintaining the same color values.*/
 #accordion { 
   padding: 0 0 0 2rem;
   margin: 0;
   font-size: 1.75em;}
.accordion h1 { 
   padding: 1.5rem 2rem;
   font-size: 1.25em;
}
.accordion h1, #accordion {
   background-color: #262626; /* Darkest - 15%*/
  
  font-weight: normal;
  color: white;
}
.accordion h1:hover {
	background-color: #666666; /* 40%*/
  color: white;
}

.accordion h1:not(:last-of-type) {
  border-bottom: 1px dotted #999999; /* 60%*/
}
.accordion div, .accordion p {
  display: none;
}
.accordion h2 {
  padding: .5rem 4rem;
  background-color:  #404040; /* 25%*/
  font-size: 1.5rem;
  color: white;
}
.accordion h2:hover {
  background-color:#666666; /* 40%*/
}
.accordion h3 {
  padding: .5rem 6rem;
  background-color:#8c8c8c; /* 55%*/
  font-size: 1.5rem;
  color: white; 
}
.accordion h3:hover {
  background-color: #a6a6a6; /* 65%*/
}
.accordion div ul li a {
  padding: .5rem 8rem;
  list-style: none;
  background-color: #bfbfbf; /* 75%*/
  font-size: 1.4rem;
  color: #0059b3; 
}

.accordion div ul li a:hover{
  background-color: #d9d9d9; /*lightest 85%*/
  color: #1a8cff; 
}
.accordion p {
  padding: 1.5rem 3.5rem;
  background-color: #f2f2f2;
  font-size: 1.2rem;
  color: #333;
  line-height: 1.3rem;
}
.accordion .in-stock-open {
  display: block;
}

.accordion a {font-size: 1rem;}

            
          
!
            
              var slideMq = window.matchMedia("(min-width: 479px)");

/* Sliding side navigation */
 function openSideNav() {
if (slideMq.matches) {
  /* the viewport is at least 479 pixels wide */
  document.getElementById("slidingSideNav").style.width = "40%";
  
} else {
  /* the viewport is less than 479 pixels wide */
  document.getElementById("slidingSideNav").style.width = "100%";
}


}
slideMq.addListener(function(changed) {
   
       document.getElementById("slidingSideNav").style.width = "0";
   
});



function closeSideNav() {
    document.getElementById("slidingSideNav").style.width = "0%";
}

/*Copyright (c) 2017 by Ryan Bobrowski (https://codepen.io/rbobrowski/pen/likvA)*/

var headers = ["H1","H2","H3","H4","H5","H6"];

$(".accordion").click(function(e) {
  var target = e.target,
      name = target.nodeName.toUpperCase();
  
  if($.inArray(name,headers) > -1) {
    var subItem = $(target).next();
    
    //slideUp all elements (except target) at current depth or greater
    var depth = $(subItem).parents().length;
    var allAtDepth = $(".accordion p, .accordion div").filter(function() {
      if($(this).parents().length >= depth && this !== subItem.get(0)) {
        return true; 
      }
    });
    $(allAtDepth).slideUp("fast");
    
    //slideToggle target content and adjust bottom border if necessary
    subItem.slideToggle("fast",function() {
        $(".accordion :visible:last");
    });
   
  }
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console