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

              
                <div id="accordian">
  <ul>
    <li>
      <h3><span class="icon-dashboard"></span>Dashboard</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>
    <!-- This is the list item that is open by default -->
    <li class="active">
      <h3><span class="icon-tasks"></span>Tasks</h3>
      <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>
      <h3><span class="icon-calendar"></span>Calendar</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><span class="icon-heart"></span>Favorites</h3>
      <ul>
        <li><a href="#">Global Favorites</a></li>
        <li><a href="#">My Favorites</a></li>
        <li><a href="#">Team Favorites</a></li>
        <li><a href="#">Settings</a></li>
      </ul>
    </li>
  </ul>
</div>  

<!-- prefix free to deal with vendor prefixes -->
<script src="http://thecodeplayer.com/uploads/js/prefixfree-1.0.7.js" type="text/javascript"></script>

<!-- jQuery -->
<script src="http://thecodeplayer.com/uploads/js/jquery-1.7.1.min.js" type="text/javascript"></script>
              
            
!

CSS

              
                /*custom font for text*/
@import url(https://fonts.googleapis.com/css?family=Nunito);
/*CSS file for fontawesome (the iconfont)*/
@import url(http://thecodeplayer.com/uploads/fonts/fontawesome/css/font-awesome.min.css);

* {
  margin: 0;
  padding: 0;
}

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

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

/*heading styles*/
#accordian h3 {
  /*fallback for browsers not supporting gradients*/
  background: #003040;
  background: linear-gradient(#003040, #002535);
  cursor: pointer;
  font-size: 12px;
  line-height: 34px;
  padding: 0 10px;
}

/*heading hover effect*/
#accordian h3:hover {
  text-shadow: 0 0 1px rgba(255,255,255,.7);
}

/*iconfont styles*/
#accordian h3 span {
  font-size: 16px;
  margin-right: 10px;
}

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

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

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

/*Hiding the non-active list items by default*/
#accordian ul ul {
  display: none;
}

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

JS

              
                $(document).ready(function() {
  $("#accordian h3").click(function() {
    //Slide up all the link lists
    $("#accordian ul ul").slideUp();
    //Slide down the link list below the h3 clicked - only if it's closed
    if(!$(this).next().is(":visible")) {
      $(this).next().slideDown();
    }
  })
})
              
            
!
999px

Console