Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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 class='container__persp'>
  <div class='container'>
    <div class='top'>
    <div class='arrow'>
    </div>
      <div class="showbox">
  <div class="loader">
    <svg class="circular" viewBox="25 25 50 50">
      <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10"/>
    </svg>
  </div>
</div>
      <h1 class='inbox'>Inbox</h1>
      <div class='allemails'>
        <p>All 162</p><span></span></div>
      <div class='pulldown'><span></span><span></span>Pull down to refresh<span></span><span></span></div>
    </div>
    <div class='emails-outter'>
      <div class='emails'>
        <ul class='email-list'>
          <a href="https://codepen.io/mrspok407/" target="_blank"><li class='email-item-new'>
            <div class='email-item__mark'>
              <div></div>
            </div>
            <div class='email-item__text'>
              <h3>Check out my other pens</h3>
              <p>so wow much such wow so much woof</p>
            </div>
          </li>
            </a>
          <li class='email-item'>
            <div class='email-item__env'><i class="fa fa-envelope" aria-hidden="true"></i></div>
            <div class='email-item__text'>
              <h3>20% off Somesite.co...</h3>
              <p>You have won a discount in our store...</p>
            </div>
          </li>
          <li class='email-item'>
            <div class='email-item__env'><i class="fa fa-envelope" aria-hidden="true"></i></div>
            <div class='email-item__text'>
              <h3>20% off Somesite.co...</h3>
              <p>You have won a discount in our store...</p>
            </div>
          </li>
          <li class='email-item'>
            <div class='email-item__warning'><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></div>
            <div class='email-item__text'>
              <h3>Secure Code Changed</h3>
              <p>Your credit card has been blocked! Please check your account information. If you...</p>
            </div>
          </li>
          <li class='email-item'>
            <div class='email-item__warning'><i class="fa fa-exclamation-triangle" aria-hidden="true"></i></div>
            <div class='email-item__text'>
              <h3>Secure Code Changed</h3>
              <p>Your credit card has been blocked! Please check your account information. If you...</p>
            </div>
          </li>
          <li class='email-item'>
            <div class='email-item__plane'><i class="fa fa-paper-plane" aria-hidden="true"></i></div>
            <div class='email-item__text'>
              <h3>You order has been s...</h3>
              <p>Detailed information you can find in your account...</p>
            </div>
          </li>
          <li class='email-item'>
            <div class='email-item__plane email-item'><i class="fa fa-paper-plane" aria-hidden="true"></i></div>
            <div class='email-item__text'>
              <h3>You order has been s...</h3>
              <p>Detailed information you can find in your account...</p>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                // Doesn't work in IE and very poorly in FF
*,
*:before,
*:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: url('https://s33.postimg.org/lsujpwtin/forest_patrol.jpg') center center no-repeat;
  background-size: cover;
}

.container__persp {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-align-items: center;
  width: 100%;
  height: 100vh;
  -webkit-perspective: 2000px;
  perspective: 2000px;
}


/*** Mixins ***/

@mixin fa {
  position: relative;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 27px;
}

@mixin arrows {
  content: '';
  display: block;
  position: absolute;
  width: 10px;
  height: 2px;
  -webkit-transform: rotate(-45deg);
  transform: rotate(-45deg);
  border-radius: 5px;
  background-color: #B9B9B9;
}

.container {
  position: relative;
  height: 505px;
  max-height: 100%;
  width: 282px;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 0 35px rgba(0, 0, 0, .75);
  overflow: hidden;
  -webkit-transform: translate3d(0, 0, 0);
  -webkit-transition: 0s;
  transition: 0s;
  .top {
    z-index: 1;
    cursor: default;
    cursor: -webkit-grab;
  }
  .arrow {
    position: absolute;
    top: 0;
    cursor: pointer;
    &:after {
      @include arrows;
      top: 25px;
      left: 15px;
    }
    &:before {
      @include arrows;
      top: 31px;
      left: 15px;
      -webkit-transform: rotate(45deg);
      transform: rotate(45deg);
    }
  }
  .inbox {
    padding-top: 60px;
    text-align: center;
    font-family: Arial;
    font-weight: 200;
    color: #4f4f4f;
  }
  .allemails {
    position: relative;
    margin: auto;
    margin-top: 25px;
    width: 72%;
    height: 31px;
    border: 1px solid #c9c9c9;
    border-radius: 20px;
    cursor: default;
    text-align: center;
    cursor: -webkit-grab;

    transform: scale(1,1);

    transform-origin: center;
    &:after {
      @include arrows;
      top: 13px;
      left: 90%;
      -webkit-transform: rotate(-45deg);
      transform: rotate(-45deg);
    }
    &:before {
      @include arrows;
      top: 13px;
      left: 87%;
      -webkit-transform: rotate(45deg);
      transform: rotate(45deg);
    }
    p {
      margin-top: 7px;
      font-family: Arial;
      font-size: 14px;
      color: #B9B9B9;
    }
  }
  .pulldown {
    position: relative;
    font-family: Arial;
    font-size: 14px;
    text-align: center;
    padding-top: 10px;
    color: #a5a5a5;
    transform: scale(1,1);
    span:first-child {
      position: absolute;
      top: 10px;
      left: 46px;
      -webkit-animation: blink 2s infinite;
      animation: blink 2s infinite;
      -webkit-animation-delay: 1s;
      animation-delay: 1s;
      &:after {
        @include arrows;
        top: 3px;
        left: 21px;
      }
      &:before {
        @include arrows;
        top: 3px;
        left: 15px;
        -webkit-transform: rotate(45deg);
        transform: rotate(45deg);
      }
    }
    span:nth-child(2) {
      position: absolute;
      ;
      top: 18px;
      left: 46px;
      -webkit-animation: blink 2s infinite;
      animation: blink 2s infinite;
      &:after {
        @include arrows;
        top: 3px;
        left: 21px;
      }
      &:before {
        @include arrows;
        top: 3px;
        left: 15px;
        -webkit-transform: rotate(45deg);
        transform: rotate(45deg);
      }
    }
    span:nth-child(3) {
      position: absolute;
      ;
      top: 10px;
      right: 91px;
      -webkit-animation: blink 2s infinite;
      animation: blink 2s infinite;
      -webkit-animation-delay: 1s;
      animation-delay: 1s;
      &:after {
        @include arrows;
        top: 3px;
        left: 21px;
      }
      &:before {
        @include arrows;
        top: 3px;
        left: 15px;
        -webkit-transform: rotate(45deg);
        transform: rotate(45deg);
      }
    }
    span:last-child {
      position: absolute;
      ;
      top: 18px;
      right: 91px;
      -webkit-animation: blink 2s infinite;
      animation: blink 2s infinite;
      &:after {
        @include arrows;
        top: 3px;
        left: 21px;
      }
      &:before {
        @include arrows;
        top: 3px;
        left: 15px;
        -webkit-transform: rotate(45deg);
        transform: rotate(45deg);
      }
    }
    @-webkit-keyframes blink {
      50% {
        opacity: 0
      }
      100% {
        opacity: 1
      }
    }
    @keyframes blink {
      50% {
        opacity: 0
      }
      100% {
        opacity: 1
      }
    }
  }
  // Outter container needed for hidding scrollbar
  .emails-outter {
    padding-top: 10px;
    height: 330px;
    overflow: hidden;
    -webkit-transition: .1s;
    transition: .1s;
    -moz-transition: 0s;
    .emails {
      height: 100%;
      width: 107%;
      margin-right: 17px;
      overflow: auto;
      -webkit-transform: translate3d(0, 0, 0);
      transform: translate3d(0, 0, 0);
      .email-list {
        list-style: none;
        li:first-child {
          border-top: 1px solid #c9c9c9;
          border-bottom: none;
          .email-item__text {
            position: relative;
            h3 {
              font-size: 15px;
            }
            &:after {
              content: '';
              display: block;
              position: absolute;
              top: 0;
              right: 2px;
              height: 69px;
              width: 4px;
              background-color: #4ECC67;
            }
          }
        }
        li:nth-child(2) {
          border-top: 1px solid #c9c9c9;
        }
        li:nth-child(3) {
          .email-item__text {
            position: relative;
            &:after {
              content: '';
              display: block;
              position: absolute;
              top: 0;
              right: 2px;
              height: 69px;
              width: 4px;
              background-color: #4AAFD1;
            }
          }
        }
        li:last-child {
          .email-item__text {
            position: relative;
            &:after {
              content: '';
              display: block;
              position: absolute;
              top: 0;
              right: 2px;
              height: 69px;
              width: 4px;
              background-color: #ade86a;
            }
          }
        }
        li {
          width: 100%;
          height: 70px;
          border-bottom: 1px solid #c9c9c9;
          -webkit-transition: .5s;
          transition: .5s;
          .email-item__env {
            display: inline-block;
            height: 100%;
            width: 75px;
            background-color: #4AAFD1;
            -webkit-transition: .3s;
            transition: .3s;
            cursor: pointer;
            &:hover {
              background-color: #f2f2f2;
              -webkit-transition: .3s;
              transition: .3s;
            }
            &:hover .fa-envelope {
              color: #4AAFD1;
              -webkit-transition: .3s;
              transition: .3s;
            }
            .fa-envelope {
              @include fa;
            }
          }
          .email-item__warning {
            position: relative;
            height: 100%;
            width: 75px;
            background-color: #FD662A;
            cursor: pointer;
            float: left;
            &:hover {
              background-color: #f2f2f2;
              -webkit-transition: .3s;
              transition: .3s;
            }
            &:hover .fa-exclamation-triangle {
              color: #FD662A;
              -webkit-transition: .3s;
              transition: .3s;
            }
            .fa-exclamation-triangle {
              @include fa;
            }
          }
          .email-item__plane {
            height: 100%;
            width: 75px;
            background-color: #ade86a;
            cursor: pointer;
            float: left;
            &:hover {
              background-color: #f2f2f2;
              -webkit-transition: .3s;
              transition: .3s;
            }
            &:hover .fa-paper-plane {
              color: #ade86a;
              -webkit-transition: .3s;
              transition: .3s;
            }
            .fa-paper-plane {
              @include fa;
            }
          }
        }
        .email-item__text {
          width: 200px;
          height: 100%;
          float: right;
          cursor: pointer;
          &:hover p {
            color: #383838;
            -webkit-transition: .3s;
            transition: .3s;
          }
          &:hover h3 {
            color: #383838;
            -webkit-transition: .3s;
            transition: .3s;
          }
          h3 {
            margin: 10px 0 0 10px;
            font-size: 17px;
            font-weight: 200;
            font-family: Arial;
            color: #a3a3a3;
            -webkit-transition: .3s;
            transition: .3s;
          }
          p {
            margin: 4px 5px 0 10px;
            font-family: Arial;
            font-size: 9px;
            color: #a3a3a3;
            -webkit-transition: .3s;
            transition: .3s;
          }
        }
        .email-item-new {
          height: 0px;
          -webkit-transform: scale(0, 0);
          transform: scale(0, 0);
          -webkit-transition: .5s;
          transition: .5s;
          -moz-transition: 0s;
          .email-item__mark {
            display: inline-block;
            height: 100%;
            width: 75px;
            -webkit-transition: .3s;
            transition: .3s;
            cursor: pointer;
            background-color: #4ACB64;
            &:hover {
              background-color: #f2f2f2;
              -webkit-transition: .3s;
              transition: .3s;
            }
            div {
              position: relative;
              height: 70px;
              width: 75px;
              -webkit-transform: scale(0, 0);
              transform: scale(0, 0);
              &:after {
                content: '';
                position: absolute;
                display: block;
                top: 31px;
                left: 28px;
                -webkit-transform: rotate(-45deg);
                transform: rotate(-45deg);
                height: 10px;
                width: 2px;
                border-radius: 3px;
                background-color: #fff;
              }
              &:before {
                content: '';
                position: absolute;
                display: block;
                top: 23px;
                left: 38px;
                -webkit-transform: rotate(45deg);
                transform: rotate(45deg);
                height: 20px;
                width: 2px;
                border-radius: 3px;
                background-color: #fff;
              }
              &:hover:after,
              &:hover:before {
                background-color: #4ACB64;
              }
            }
            .scale {
              -webkit-transform: scale(1, 1);
              transform: scale(1, 1);
              -webkit-transition: 1.5s;
              transition: 1.5s;
            }
          }
        }
        .email-item-new-scale {
          height: 70px;
          -webkit-transform: scale(1, 1);
          transform: scale(1, 1);
          -webkit-transition: .5s;
          transition: .5s;
        }
      }
    }
  }
}

.bounce {
  -webkit-animation: bounce .5s;
  animation: bounce .5s;
  -webkit-animation-delay: .175s;
  animation-delay: .175s;
  @-webkit-keyframes bounce {
    25% {
      -webkit-transform: translateY(-3px);
      transform: translateY(-3px)
    }
    50% {
      -webkit-transform: translateY(2px);
      transform: translateY(2px)
    }
    75% {
      -webkit-transform: translateY(-1px);
      transform: translateY(-1px)
    }
    100% {
      -webkit-transform: translateY(0px);
      transform: translateY(0px)
    }
  }
  @keyframes bounce {
    25% {
      -webkit-transform: translateY(-3px);
      transform: translateY(-3px)
    }
    50% {
      -webkit-transform: translateY(2px);
      transform: translateY(2px)
    }
    75% {
      -webkit-transform: translateY(-1px);
      transform: translateY(-1px)
    }
    100% {
      -webkit-transform: translateY(0px);
      transform: translateY(0px)
    }
  }
}

.showbox {
  position: absolute;
  display: none;
  top: -20px;
  bottom: 0;
  left: 0;
  right: 0;
  -webkit-transform: scale(.5, .5);
  transform: scale(.5, .5);
}

.loader {
  position: relative;
  margin: 0px auto;
  width: 100px;
  &:before {
    content: '';
    display: block;
    padding-top: 100%;
  }
}

.circular {
  -webkit-animation: rotate 2s linear infinite;
  animation: rotate 2s linear infinite;
  height: 100%;
  -webkit-transform-origin: center center;
  transform-origin: center center;
  width: 100%;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
}

.path {
  stroke-dasharray: 1, 200;
  stroke-dashoffset: 0;
  stroke: #c9c9c9;
  -webkit-animation: dash 1.5s ease-in-out infinite;
  animation: dash 1.5s ease-in-out infinite;
  stroke-linecap: round;
}

@-webkit-keyframes rotate {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@keyframes rotate {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@-webkit-keyframes dash {
  0% {
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 89, 200;
    stroke-dashoffset: -35px;
  }
  100% {
    stroke-dasharray: 89, 200;
    stroke-dashoffset: -124px;
  }
}

@keyframes dash {
  0% {
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 89, 200;
    stroke-dashoffset: -35px;
  }
  100% {
    stroke-dasharray: 89, 200;
    stroke-dashoffset: -124px;
  }
}
              
            
!

JS

              
                $(document).ready(function() {
  $(document).disableSelection();
  var $container = $('.container'),
      $pullDown = $('.pulldown'),
      $allemails = $('.allemails'),
      $emailsItemNew = $('.email-item-new'),
      $emailsItemMark = $('.email-item__mark'),
      $showbox = $('.showbox'),
      $top = $('.top'),
      refreshArr = ['.inbox', '.allemails', '.pulldown', '.emails-outter', '.container'],
      refreshArrLength = refreshArr.length,
      deltaY = 0,
      offsetLeftCont = $container.offset().left,
      offsetTopCont = $container.offset().top,
      offsetPulldown = $pullDown.offset().top,
      halfWidthCont = 141,
      halfHeightCont = 250,
      animating = false;

  $(window).resize(function() {
      offsetLeftCont = $container.offset().left;
      offsetTopCont = $container.offset().top;
      offsetPulldown = $pullDown.offset().top;
  });
  
  var mousemoveHandler = function(e) {
    var x = e.pageX,
        y = e.pageY;
        deltaY = e.pageY;

    (function lean() {
      var pXoffsetPos = (((x - offsetLeftCont) - halfWidthCont) / 14),
          pXoffsetNeg = (((x - offsetLeftCont + halfWidthCont) - ((x - offsetLeftCont) * 2)) / 14),
          pYoffset = (((y - offsetTopCont + halfHeightCont) - ((y - offsetTopCont) * 2)) / 25);
      return [
        $container.css('transform', 'rotateY(' + pXoffsetPos + 'deg) rotateX(' + pYoffset + 'deg)'),
        $container.css('transform', 'rotateY(-' + pXoffsetNeg + 'deg) rotateX(' + pYoffset + 'deg)'),
        $container.css('box-shadow', '-' + pXoffsetPos + 'px ' + pYoffset + 'px 29px 0px rgba(0,0,0,0.75)'),
        $container.css('box-shadow', pXoffsetNeg + 'px ' + pYoffset + 'px 29px 0px rgba(0,0,0,0.75)')
      ];
    })();

    (function grab() {
      function grabing(el, divide) {
        $(el).css('transform', 'translateY(' + ((y - offsetPulldown - 22) / divide) + 'px)');
      }
      for (var i = 8, j = 0; i >= 2, j < refreshArrLength - 2; i /= 2, j++) {
        grabing(refreshArr[j], i);
      }
      grabing('.emails-outter', 1);

      function refresh(el, tran) {
        $(el).css({
          'transform': 'translateY(' + tran + 'px)',
          'transition': '.1s',
          '-moz-transition': '0s'
        });
      }
      // If statments so you only be able drag stuff in a particular area
      if (y > (offsetTopCont + 350)) {
        for (var i = 22, j = 0; i <= 180, j < refreshArrLength - 1; i *= 2, j++) {
          refresh(refreshArr[j], i);
        }
      } else if (y < (offsetTopCont + 175)) {
        for (var i = 0; i < refreshArrLength - 1; i++) {
          $(refreshArr[i]).css('transform', '');
        }
      }
    })();
  };

  var loading = function(el, num) {
    $(el).css({
      'opacity': '0',
      'transform': 'scale(0,1)',
      'transition': 'transform .4s'
    });
    $showbox.show();
    setTimeout(function() {
      $(el).css({
        'opacity': '1',
        'transform': 'scale(1,1)',
        'transition': '.4s',
        '-moz-transition': '0s'
      });
      $(el).children('p').text('All 163');
      $showbox.hide();
    }, 2000);
    setTimeout(function() {
      $emailsItemNew.addClass('email-item-new-scale');
      $emailsItemMark.children('div').addClass('scale');
    }, 2150);
    $(document).off('mousemove mouseup');
    for (var i = 0; i < refreshArrLength - 1; i++) {
      if(i === 1 || i === 2) continue;
      $(refreshArr[i]).css({
        'transform': '',
        'transition': '.2s',
        '-moz-transition': '0s'
      }).addClass('bounce');
    }
  };

  var noLoading = function(bounce) {
    for (var i = 0; i < refreshArrLength - 1; i++) {
      $container.css({
        'transform': '',
        'transition': '.5s',
        '-moz-transition': '0s',
        'box-shadow': '0 0 35px rgba(0, 0, 0, .75)'
      });

      $(refreshArr[i]).css({
        'transform': '',
        'transition': '.2s',
        '-moz-transition': '0s'
      }).addClass(bounce);
      $(document).off('mousemove mouseup');
    }
  };

  var mouseupHandler = function() {
    if (deltaY > (offsetTopCont + 300)) {
      noLoading();
      loading('.allemails, .pulldown', 1);
      animating = true;
      setTimeout(function() {
        animating = false;
      }, 2150);
    } else if (deltaY > (offsetTopCont + 191)) {
      noLoading('bounce');
    } else {
      noLoading();
    }
  };

  var toDefault = function() {
    for (var i = 0; i < refreshArrLength; i++) {
      $(refreshArr[i]).css({
        'transform': '',
        'transition': 'transform .1s, box-shadow 0s',
        '-moz-transition': '0s'
      });
    }
    $('.allemails, .pulldown').css({
      'opacity': '1',
      'transform': 'scale(1,1)',
      'transition': '0s'
    });
    $allemails.children('p').text('All 162');
    $emailsItemNew.removeClass('email-item-new-scale');
    for (var i = 0; i < refreshArrLength - 1; i++) {
      $(refreshArr[i]).removeClass('bounce');
    }
    $emailsItemNew.removeClass('email-item-new-scale');
    $emailsItemMark.children('div').removeClass('scale');
  };

  $(document).on('mousedown', '.top', function() {
    if (animating === false) {
      $(document).on('mousemove', mousemoveHandler);
      $(document).on('mouseup', mouseupHandler);
      toDefault();
    }
  });
});
              
            
!
999px

Console