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.

            
              .panel#js-panel
  .panel__content
    %h4 Just Checking...
    %h2 Delete your Account?
    %p This action is final and you will be unable to recover any data
  .panel__flaps
    .flap.outer.flap--left
    %a.flap.flap__btn{href:'#'} YES
    %a.flap.flap__btn{href:'#'} NO
    .flap.outer.flap--right

%a#js-replay.replay{href:'#'} Replay
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Lato:300,400,700);

// Variables
$body-bg:  #2e2e2e;
$purple:   #865fdf;
$btn-bg:   #8f69e8;
$panel-bg: #fff;
$ease:     cubic-bezier(0.55, 0.085, 0.68, 0.53);
$quart:    cubic-bezier(0.165, 0.84, 0.44, 1);

.panel {
  background: rgba(black, .3);
  box-shadow: 0 0 30px 10px rgba(black, .3);
  border-radius: 25px;
  transition: .2s $ease;
  transform: rotateX(-90deg);
  &.is--open {
    transform: rotateX(0deg);
  }
}

.panel__content {
  padding-bottom: 4em;
  background: $panel-bg;
  border-top-left-radius: 25px;
  border-top-right-radius: 25px;
  color: #5a5a5a;
  text-align: center;
  
  h4 {
    padding: 1.5em 0;
    border-bottom: 2px solid #ededed;
    color: $purple;
    font-size: 1.15em;
    font-weight: 700;
    text-transform: uppercase;
  }
  h2 {
    padding: .5em 1.5em;
    font-size: 3em;
    font-weight: 300;
  }
  p {
    margin: auto;
    width: 55%;
    font-size: 1.15em;
    font-weight: 300;
    line-height: 1.4;
  }
}

.panel__flaps {
  display: flex;
  perspective: 1000px;
  transform-style: preserve-3d;
}
  .flap {
    height: 100px;
    background: $purple;
  }
    .flap__btn {
      width: calc((100% - 212px) / 2);
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      background: $btn-bg;
      color: white;
      cursor: pointer;
      font-size: 2.25em;
      font-weight: 700;
      text-decoration: none;
      z-index: 1;
      transition: .2s ease;
      transform: translate3d(0,0,0);
      transform-origin: top center;
      
      &:hover,
      &:focus {
        background: $purple;
        outline: none;
        transform: rotateX(-25deg) translate3d(0,0,0);
      }
    }
    .outer { width: 106px; }
    .flap--left {
      border-bottom-left-radius: 25px;
      transform-origin: top right;
    }
    .flap--right {
      border-bottom-right-radius: 25px;
      transform-origin: top left;
    }
  .is--open {
    .outer {
      animation: swing 1.5s .2s ease;
    }
    .flap__btn:first-of-type {
      animation: swing 1.5s .3s ease;
    }
    .flap__btn:last-of-type {
      animation: swing 1.5s .4s ease;
    }
  }

@keyframes swing {
  10%  { transform: rotateX(25deg);   }
  50%  { transform: rotateX(-15deg);  }
  75%  { transform: rotateX(5deg);    }
  90%  { transform: rotateX(-2.5deg); }
  100% { transform: rotateX(0deg);    }
}

.replay {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: .5em;
  background: $purple;
  border-radius: 3px;
  color: white;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  text-decoration: none;
  transition: all .3s;
  transform: translate(-50%,-50%);
  
  &:hover,
  &:focus  {
    background: $btn-bg;
    outline: none;
    box-shadow: 0 0 25px $purple;
  }
  &:active {
    transform: translate(-50%,-50%) scale(.9);
  }
  
  &.is--active {
    opacity: 1;
    pointer-events: initial;
  }
}


// Presentation Styles
*, *:before, *:after {
  -webkit-font-smoothing: antialiased;
          font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  box-sizing: border-box;
}
html, body { height: 100%; }
body {
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: $body-bg;
  font-family: "Lato", Arial, sans-serif;
  perspective: 1000px;
  transform-style: preserve-3d;
}
            
          
!
            
              (function() {
  // Variables
  var panel     = document.getElementById("js-panel");
  var btns      = document.querySelectorAll(".flap__btn");
  var btnReplay = document.getElementById("js-replay");
  
  // On load, init panel
  var init = function() {
    panel.classList.add("is--open");
    
    // If btns are clicked, hide panel
    // Show replay button    
    for (var i=0; i < btns.length; i++) {
      btns[i].addEventListener("click", function() {
        hidePanel();
      });
    }
    
    function hidePanel() {
      panel.classList.remove("is--open");
      btnReplay.classList.add("is--active");
    }
    
    // When replay button is clicked,
    // reset the stage.
    btnReplay.addEventListener("click", function() {
      resetStage();
    });
  }
  
  // Hide the button and re-call init
  function resetStage() {
    btnReplay.classList.remove("is--active");
    init();
  }
  
  // On load, call init function
  window.onload = function() {
    init();
  }
})();
            
          
!
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