startv

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
via CSS Lint

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
via JS Hint

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.

HTML

            
              <ul>
  <li>
    <h1>Some Title #1</h1>
    <p>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
    </p>
  </li>
  <li>
    <h1>Some Title #2</h1>
    <p>
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
    </p>
  </li>
</ul>
            
          
!

CSS

            
              @import "compass/css3";

ul {
  list-style: none;
  margin: 0 40px;
  padding: 0;
  
  li {
    float: left;
    width: 300px;
  }
  
  h1 {
    cursor: pointer;
  }
  
  p {
    display: none;
  }
}
            
          
!

JS

            
              $('h1').on('click', function() {
  var $this = $(this),
      $next = $this.next();
  
  // Check if another profile is open and close it
  var $last = $('p:visible', $this.parents('ul'));
  
  if ($last.length) {
    $last.slideUp('fast');
  }
  
  // Show the new profile content only if we are opening a
  // new profile
  if ($last.parents('li').index() !== $this.parent().index()) {
    $next.slideDown('fast');
  }
});
            
          
!
999px
Loading ..................

Console