JSFiddle - React, Tailwind, and code Playground

by Keith Jeter

HTML

<div class="demo">
  <svg class="sidebar" viewBox="0 0 300 500">
    <path class="s-path" fill="#fff" d="M0,0 50,0 a0,250 0 1,1 0,500 L0,500" />
  </svg>
  <div class="static">
    <div class="static__text">Pull white sidebar to the right</div>
  </div>
  <div class="sidebar-content">
    <div class="contact">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/elastic-man.png" alt="" class="contact__photo" />
      <span class="contact__name">Ethan Hawke</span>
      <span class="contact__status online"></span>
    </div>
    <div class="contact">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/elastic-girl.png" alt="" class="contact__photo" />
      <span class="contact__name">Natalie Portman</span>
      <span class="contact__status online"></span>
    </div>
    <div class="contact">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/elastic-man.png" alt="" class="contact__photo" />
      <span class="contact__name">Kevin Spacey</span>
      <span class="contact__status online"></span>
    </div>
    <div class="contact">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/elastic-girl.png" alt="" class="contact__photo" />
      <span class="contact__name">Rosamund Pike</span>
      <span class="contact__status online"></span>
    </div>
    <div class="contact">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/elastic-man.png" alt="" class="contact__photo" />
      <span class="contact__name">Robert Redford</span>
      <span class="contact__status online"></span>
    </div>
    <div class="contact">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/elastic-girl.png" alt="" class="contact__photo" />
      <span class="contact__name">Scarlett Johansson</span>
      <span class="contact__status online"></span>
    </div>
    <div class="contact">
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/elastic-man.png" alt=""...

CSS

*, *:before, *:after {
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-size: 62.5%;
  height: 100%;
}

button, input {
  border: 0;
  outline: none;
}

body {
  background: linear-gradient(45deg, #636f85, #6960a0);
}

.demo {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -25rem;
  margin-left: -15rem;
  width: 30rem;
  height: 50rem;
  -webkit-box-shadow: 0 1rem 5rem rgba(0, 0, 0, 0.3);
          box-shadow: 0 1rem 5rem rgba(0, 0, 0, 0.3);
}

.static {
  height: 100%;
  font-size: 1.8rem;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  background: #6D7ADA;
}
.static:before, .static:after {
  content: "";
  position: absolute;
  left: 7rem;
  width: 2rem;
  height: 2rem;
  margin-left: -1rem;
  margin-top: -1rem;
  border: 2px solid #fff;
  border-left: none;
  border-bottom: none;
  -webkit-transform: rotate(45deg);
          transform: rotate(45deg);
  -webkit-animation: arrows 1.5s infinite;
          animation: arrows 1.5s infinite;
}
.static:before {
  top: 15rem;
}
.static:after {
  top: 35rem;
}
.static__text {
  width: 9rem;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-left: -5rem;
  -webkit-transform: translate3d(0, -50%, 0);
          transform: translate3d(0, -50%, 0);
  color: #fff;
  -webkit-perspective: 1px;
          perspective: 1px;
  -webkit-backface-visibility: hidden;
          backface-visibility: hidden;
}

.sidebar-content {
  z-index: -1;
  position: absolute;
  top: 0;
  left: 0;
  width: 20rem;
  height: 100%;
  padding-top: 1rem;
  opacity: 0;
  -webkit-transition: opacity 200ms, z-index 0s 0s;
  transition: opacity 200ms, z-index 0s 0s;
  background-color: #E9EAF3;
  overflow: hidden;
}
.sidebar-content.active {
  z-index: 2;
  opacity: 1;
}

.contact {
  position: relative;
  width: 100%;
  height: 5rem;
  padding-left: 1.7rem;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
     ...

JavaScript

$(document).ready(function() {
  var $svg = $(".sidebar"),
      $demo = $(".demo"),
      $path = $(".s-path"),
      $sCont = $(".sidebar-content"),
      $chat = $(".chat"),
      demoTop = $demo.offset().top,
      demoLeft = $demo.offset().left,
      diffX = 0,
      curX = 0,
      finalX = 0,
      frame = 1000 / 60,
      animTime = 600,
      sContTrans = 200,
      animating = false;

  var easings = {
    smallElastic: function(t,b,c,d) {
      var ts = (t/=d)*t;
      var tc = ts*t;
      return b+c*(33*tc*ts + -106*ts*ts + 126*tc + -67*ts + 15*t);
    },
    inCubic: function(t,b,c,d) {
      var tc = (t/=d)*t*t;
      return b+c*(tc);
    }
  };

  function createD(top, ax, dir) {
    return "M0,0 "+top+",0 a"+ax+",250 0 1,"+dir+" 0,500 L0,500";
  }

  var startD = createD(50,0,1),
      midD = createD(125,75,0),
      finalD = createD(200,0,1),
      clickMidD = createD(300,80,0),
      clickMidDRev = createD(200,100,1),
      clickD = createD(300,0,1),
      currentPath = startD;

  function newD(num1, num2) {
    var d = $path.attr("d"),
        num2 = num2 || 250,
        nd = d.replace(/\ba(\d+),(\d+)\b/gi, "a" + num1 + "," + num2);
    return nd;
  }

  function animatePathD(path, d, time, handlers, callback, easingTop, easingX) {
    var steps = Math.floor(time / frame),
        curStep = 0,
        oldArr = currentPath.split(" "),
        newArr = d.split(" "),
        oldLen = oldArr.length,
        newLen = newArr.length,
        oldTop = +oldArr[1].split(",")[0],
        topDiff = +newArr[1].split(",")[0] - oldTop,
        nextTop,
        nextX,
        easingTop = easings[easingTop] || easings.smallElastic,
        easingX = easings[easingX] || easingTop;

    $(document).off("mousedown mouseup");

    function animate() {
      curStep++;
      nextTop = easingTop(curStep, oldTop, topDiff, steps);
      nextX = easingX(curStep, curX, finalX-curX, steps);
      oldArr[1] = nextTop + ",0";
      oldArr[2] = "a" + Math.abs(nextX) +...