123

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

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

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.

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.

            
              <div class="wrapper wrapper1"  id="wrapper">
  <p class="click-text">
    What does Marsellus Wallace not look like? <span class="arrow"></span>
  </p>
  <ul>
    <li>Black</li>
    <li>Bald</li>
    <li>A Bitch</li>
  </ul>  
</div>

<div class="wrapper wrapper2"  id="wrapper2">
  <p class="click-text">
    Malkovich malkovich? <span class="arrow"></span>
  </p>
  <ul>
    <li>Malkovich</li>
    <li>Malkovich</li>
    <li>Malkovich</li>
  </ul>  
</div>

<div class="wrapper wrapper3"  id="wrapper3">
  <p class="click-text">
    What is your favourite colour? <span class="arrow"></span>
  </p>
  <ul>
    <li>Blue</li>
    <li>Yellow</li>
    <li>Not Sure</li>
  </ul>  
</div>
            
          
!
            
              body
  color: white
  font-family: sans-serif
  background-color: #616161
  font-family: 'Source Sans Pro', sans-serif

.wrapper
  margin: 40px auto
  width: 400px
  display: block
  text-align: center
  transition: 0.15s ease
  &.active
    .arrow 
      transform: rotate(45deg) translate(-5px,-5px)
      &:before
        transform: translate(10px,0)
      &:after
        transform: rotate(90deg) translate(10px,0)
    ul
      opacity: 0.3
      height: 108px
      
.wrapper2
  ul
    border: 1px solid rgba(255, 255, 255, 0.5)
  li
    &:first-child
      margin-top: 16px
    &:last-child
      margin-bottom: 3px
  &.active
    ul
      margin-top: 12px
    .arrow
      transform: rotate(45deg) translate(38px,38px)
      opacity: 0.6
      &:before
        transform: translate(5px,0)
      &:after
        transform: rotate(90deg) translate(5px,0)

.wrapper3
  .arrow
    transform: rotate(0)
    left: 0
    &:before, &:after
      background-color: transparent
      width: 3px
      height: 10px
      display: inline-block
      position: absolute
      border-bottom: 12px solid white
      top: 0
      left: 0
      transform: rotate(0)
    &:before
      transform: rotate(-135deg)
    &:after 
      transform: rotate(135deg)
      
  &.active
    .arrow
      transform: rotate(0)
      transform: translate(0, -6px)
      &:before
        transform: rotate(-45deg)
      &:after
        transform: rotate(45deg)
      
  

.arrow
  width: 13px
  height: 13px
  display: inline-block
  position: relative
  bottom: -5px
  left: -10px
  transition: 0.4s ease
  margin-top: 2px
  text-align: left
  transform: rotate(45deg)
  float: right
  &:before, &:after
    position: absolute
    content: ''
    display: inline-block
    width: 12px
    height: 3px
    background-color: #fff
    transition: 0.4s ease
  &:after
    position: absolute
    transform: rotate(90deg)
    top: -5px
    left: 5px
  
.click-text 
  display: block
  text-align: left
  padding: 0 12px 16px
  margin: 0
  cursor: pointer
  color: rgba(255, 255, 255, 0.3)
  border-bottom: 1px solid rgba(255, 255, 255, 0.2)
  transition: 0.15s ease
  &:hover
    color: rgba(255, 255, 255, 0.6)
    border-bottom-color: rgba(255, 255, 255, 0.4)
  
ul
  padding: 0
  margin: 0
  height: 0
  overflow: hidden
  opacity: 0
  transition: 0.4s ease
  border-bottom: 1px solid rgba(255, 255, 255, 0.5)

li
  list-style-type: none
  margin: 0 auto
  padding: 4px 12px
  text-align: left
  cursor: pointer
  &:first-child
    margin-top: 12px
  &:last-child
    margin-bottom: 12px


  
            
          
!
            
              document.getElementById('wrapper').onclick = function() {

    var className = ' ' + wrapper.className + ' ';

    this.className = ~className.indexOf(' active ') ?
                         className.replace(' active ', ' ') :
                         this.className + ' active';
};

document.getElementById('wrapper2').onclick = function() {

    var className = ' ' + wrapper2.className + ' ';

    this.className = ~className.indexOf(' active ') ?
                         className.replace(' active ', ' ') :
                         this.className + ' active';
}

document.getElementById('wrapper3').onclick = function() {

    var className = ' ' + wrapper3.className + ' ';

    this.className = ~className.indexOf(' active ') ?
                         className.replace(' active ', ' ') :
                         this.className + ' active';
}
            
          
!
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.

Console