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

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.

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="center">

  <div class="iphone">

    <div class="iphone__upper">
      <span class="speaker_yo"></span>
    </div>

    <div class="list__wrapper">
      <!-- SVG -->
      <div class="svg__wrapper">

        <svg width="322" height="180" viewBox="0 0 320 180" xmlns="http://www.w3.org/2000/svg" version="1.1">
          <defs>
            <filter id="goo">
              <feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
              <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 18 -7" result="goo" />
              <feBlend in="SourceGraphic" in2="goo" />
            </filter>
            <filter id="fgoo">
              <feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
              <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 19 -9" result="goo" />
              <feComposite in="SourceGraphic" in2="goo" operator="atop" />
            </filter>
          </defs>
          <g id="gooey-group">
            <path id="curve" d="M0 90 Q 161 90 322 90" fill="white"></path>
          </g>

          <g id="circle_group">
            <circle id="circle" cx="160" cy="190" r="20" fill="rgba(255,255,255,0)"></circle>
          </g>
          <!-- <path id="bottom-line" d="M0,120 L320,120 L320,90 L0,90" fill="white" stroke="white"></path> -->
        </svg>

        <svg width="90" height="90" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" version="1.1">
          <path id="progress" d="M45,100a55,55 0 1,0 110,0a55,55 0 1,0 -110,0" fill="transparent" stroke="white" stroke-width="8"></path>
        </svg>


      </div>

      <!--  -->
      <ul class="list">
        <li class="list__item">
          <span class="avatar"></span>
          <span class="line-top"></span>
          <span class="line-mid"></span>
          <span class="line-bottom"></span>
        </li>
        <li class="list__item">
          <span class="avatar"></span>
          <span class="line-top"></span>
          <span class="line-mid"></span>
          <span class="line-bottom"></span>
        </li>
        <li class="list__item">
          <span class="avatar"></span>
          <span class="line-top"></span>
          <span class="line-mid"></span>
          <span class="line-bottom"></span>
        </li>
        <li class="list__item">
          <span class="avatar"></span>
          <span class="line-top"></span>
          <span class="line-mid"></span>
          <span class="line-bottom"></span>
        </li>
        <li class="list__item">
          <span class="avatar"></span>
          <span class="line-top"></span>
          <span class="line-mid"></span>
          <span class="line-bottom"></span>
        </li>
      </ul>
    </div>


  </div>


</div>
              
            
!

CSS

              
                @import 'compass/css3';
$purple : #8B90B1;
$light  : #C0C4D7;

@mixin long-shadow($type, $color, $length, $fadeout: true, $skew: false, $direction: right){
  $shadow: '';
  @if $skew == false or $type == text{
    @if $direction == right {
      @for $i from 0 to $length - 1 {
        $shadow: $shadow + $i + 'px ' + $i + 'px 0 ' + $color + ',';
      }
    }
    @if $direction == left {
      @for $i from 0 to $length - 1 {
        $shadow: $shadow + $i * -1 + 'px ' + $i + 'px 0 ' + $color + ',';
       }
      }
     }

   @if $fadeout == true{
    @for $i from 1 to $length - 1 {
      @if $type == text or $skew == false{
        @if $direction == right{
          $shadow: $shadow + $i + 'px ' + $i + 'px 0 ' +       rgba($color, 1 - $i / $length) + ',';
        }
        @if $direction == left{
          $shadow: $shadow + $i * -1 + 'px ' + $i + 'px 0 ' +       rgba($color, 1 - $i / $length) + ',';
        }
      }
      @if ($type == box) and $skew == true{
        @if $direction == right {
          $shadow: $shadow + $i + 'px ' + $i + 'px 0 ' + $i * .2 + 'px ' + rgba($color, 1 - $i / $length) + ',';
        }
        @if $direction == left {
          $shadow: $shadow + $i * -1 + 'px ' + $i + 'px 0 ' + $i * .2 + 'px ' + rgba($color, 1 - $i / $length) + ',';
        }
      }
  }
  $shadow: $shadow + $length + 'px ' + $length + 'px 0 ' + rgba($color, 0);
 }
 @if $fadeout == false{
   @if $skew == true and ( $type == box ){
     @for $i from 0 to $length - 1 {
            $shadow: $shadow + $i + 'px ' + $i + 'px 0 ' + $i * .1 + 'px ' + $color + ',';
      }
   }
    $shadow: $shadow + $length + 'px ' + $length + 'px 0 ' + rgba(0,0,0,0);
 }
 $shadow: unquote($shadow);
  @if $type == 'box' {box-shadow: $shadow;}
  @if $type == 'text' {text-shadow: $shadow;}
}

body,html{
  height:100%;
  width:100%;
  display: table;
  background-color: #F4F4F6;
}
.center{
  width:100%;
  display: table-cell;
  vertical-align: middle;
}

.iphone{
  border:1px solid #C0C4D7;
  width:320px;
  max-height: 500px;
  margin:50px auto;
  overflow: hidden;
  @include long-shadow(box, rgba(236,237,242,1), 120, true, true);
}
.iphone__upper{
  height:50px;
  background-color: $light;
  z-index: 2;
  position: relative;
  .speaker_yo{
    @include border-radius(8px);
    height:8px;
    width:50%;
    left:50%;
    bottom:12px;
    @include transform(translate(-50%,0));
    position: absolute;
    background-color: #F4F4F4;
  }
}
.list__wrapper{
  // background-color: $purple;
  @include transform(translate3d(0,-183px,0));
  background-color: white;
}
.list{
  // opacity:0.2;
  list-style-type: none;
  padding-left: 0;
  margin:0;
  position: relative;
  cursor: -webkit-grab;
  cursor: grab;
  &:active { 
    cursor: grabbing;
    cursor: -moz-grabbing;
    cursor: -webkit-grabbing;
  }
}
.list__item{
  padding:15px;
  background-color: white;
  position: relative;
  .avatar{
    display: inline-block;
    background-color: $light;
    border-radius: 4px;
    width:60px;
    height:60px;
  }
}
.line-top,
.line-mid,
.line-bottom{
  @include border-radius(8px);
  height:8px;
  width:50%;
  margin-left: 12px;
  position: absolute;
  background-color: #C0C4D7;
}
.line-top{
  top:22px;
  width:100px;
}
.line-mid{
  bottom:40px;
}
.line-bottom{
  width:65%;
  bottom:26px;
}
.svg__wrapper{
  position: relative;
  z-index: 10;
  background-color: #8B90B1;
  cursor: -webkit-grab;
  cursor: grab;
  &:active { 
    cursor: grabbing;
    cursor: -moz-grabbing;
    cursor: -webkit-grabbing;
  }
  svg{
    &:first-child{
      @include transform(translate3d(0,93px,0));
    }
    &:nth-child(2){
      position: absolute;
      top:93px;
      left:116px;
    }
    #progress{
      stroke-dashoffset:345.6;
      stroke-dasharray:345.6;
    }
  }
  .border{
    position: absolute;
    top:100%;
    width:100%;
    height:20px;
    background-color: #fff;
  }
}

              
            
!

JS

              
                /*
  Quick sunday afternoon remake of Ramotion's pull to refresh concept. Works on  mobile too.
  https://dribbble.com/shots/1797373-Pull-Down-To-Refresh
*/


$(document).ready(function() {

  var START = undefined,
    LIMIT = 100,

    LIST = $('.list__wrapper'),
    CURVE = $('#curve'),
    CIRCLE = $('#circle'),
    FRICTION = 1,
    FPS = 35,
    DIFFERENCE,
    ANIMATING,
    TRANSLATE_HEIGHT = 90,
    REACHED_END = false,
    CURVE_HEIGHT = 190,
    START_CURVE = 'M-10 90 Q 161 90 332 90',
    END_CURVE = 'M-10 90 Q 161 120 332 90';

  $(".list__wrapper").on('touchstart mousedown',function(event) {
    event.stopPropagation(); 
    event.preventDefault();
    START = event.clientY || event.originalEvent.touches[0].clientY || event.originalEvent.changedTouches[0].clientY;

    $(window).on('touchmove mousemove', function(event){
      event.stopPropagation();
      event.preventDefault();

      if (ANIMATING) {
        return false;
      }
      if(event.type === 'touchmove'){
        var touch = event.originalEvent.touches[0] || event.originalEvent.changedTouches[0];
        DIFFERENCE = (START - touch.clientY) * (-1);

      } else {
        DIFFERENCE = (START - event.clientY) * (-1);
      }

      if (DIFFERENCE < TRANSLATE_HEIGHT) {
        translateSVG(DIFFERENCE);
        setOpacity(DIFFERENCE);
        REACHED_END = false;

      } else if (DIFFERENCE > TRANSLATE_HEIGHT && DIFFERENCE < CURVE_HEIGHT) {
        outerCurve(DIFFERENCE);
        setOpacity(DIFFERENCE);
        REACHED_END = false;
      } else if (DIFFERENCE >= CURVE_HEIGHT) {
        REACHED_END = true;
      }
    });
  });

  $(window).on('touchend mouseup', function(event) {
    event.stopPropagation();
    event.preventDefault();
    START = 0;
    if (REACHED_END) {
      runAnimation();
    } else {
      backToStart();
    }
    $(window).off('mousemove');
  });

  function backToStart() {
    if (DIFFERENCE > TRANSLATE_HEIGHT) {
      setTimeout(function() {
        $({
          x: parseInt($('.list__wrapper').css('transform').split(',')[5])
        }).animate({
          x: -183
        }, {
          duration: 300,
          step: function(now) {
            $('.list__wrapper').css({
              transform: 'translate3d(0,' + now + 'px,0)'
            })
          }
        });
      }, 100);
      $('.list').velocity({
        opacity: 1,
        duration: 300,
        delay: 200
      });
      $("#curve").velocity({
        tween: [90, DIFFERENCE]
      }, {
        duration: 150,
        loop: false,
        /*easing: [ 300, 8 ],*/
        easing: 'easeOutCubic',
        progress: function(e, c, r, s, t) {
          if (t > 90) {
            $('#curve').attr('fill', '#8B90B1');
          } else {
            $('#curve').attr('fill', 'white');
          }
          createCurve(t);
        }
      });
    } else {
      $({
        x: parseInt($('.list__wrapper').css('transform').split(',')[5])
      }).animate({
        x: -183
      }, {
        duration: 300,
        step: function(now) {
          $('.list__wrapper').css({
            transform: 'translate3d(0,' + now + 'px,0)'
          })
        }
      });
      $('.list').velocity({
        opacity: 1,
        duration: 300,
        delay: 200
      });
    }
  }

  function translateSVG(offset) {
    var dist = offset - 183;
    if (dist > -188) {
      $(LIST).css({
        transform: 'translate3d(0,' + dist + 'px,0)'
      });
    }
  }

  function setOpacity(distance) {
    distance = 140 - distance;
    var pct = distance / 140;
    $('.list').css({
      opacity: pct
    });
  }

  function runAnimation() {
    ANIMATING = true;

    $('svg:first-child').css({
      'filter': 'url(#goo)',
      '-webkit-filter': 'url(#goo)',
      '-moz-filter': 'url(#goo)',
      '-o-filter': 'url(#goo)',
      '-ms-filter': 'url(#goo)'
    });
    $("#curve").velocity({
      tween: [90, 200]
    }, {
      duration: 700,
      loop: false,
      easing: [0, 3, .3, 0.4],
      progress: function(e, c, r, s, t) {
        if (t > 90) {
          $('#curve').attr('fill', '#8B90B1');
        } else {
          $('#curve').attr('fill', 'white');
        }
        createCurve(t);
      }
    });
    setTimeout(function() {
      $('#circle_group').attr({
        'cy': 110
      });
      $('#circle').attr({
        fill: 'rgba(255,255,255,1)'
      });
      $('#circle').velocity({
        cy: 45
      }, {
        duration: 200,
        easing: 'easeOutSine'
      });

      $('#progress').velocity({
        strokeDashoffset: 0
      }, {
        duration: 800,
        delay: 300
      });
      $('svg:nth-child(2)').velocity({
        scale: 1.15,
        opacity: 0,
      }, {
        duration: 400,
        delay: 1200,
        easing: [.11, 1, .34, .98]
      });
      setTimeout(function() {
        $('#curve').attr('d', END_CURVE);
      }, 1450);
      setTimeout(function() {
        $('svg:first-child').css({
          'filter': 'none',
          '-webkit-filter': 'none',
          '-moz-filter': 'none',
          '-o-filter': 'none',
          '-ms-filter': 'none'
        });
      }, 1800);
      $('#circle').velocity({
        cy: 140
      }, {
        duration: 450,
        delay: 1300,
        complete: function() {
          $('#curve').attr('d', START_CURVE);
          $({
            x: parseInt($('.list__wrapper').css('transform').split(',')[5])
          }).animate({
            x: -183
          }, {
            step: function(now) {
              $('.list__wrapper').css({
                transform: 'translate3d(0,' + now + 'px,0)'
              })
            }
          });
          $('.list').velocity({
            opacity: 1
          }, 500);
          $('#circle').attr('cy', 190);
          $('#progress').css({
            strokeDashoffset: 345.6
          });
          $('svg:nth-child(2)').velocity({
            scale: 1,
            opacity: 1
          }, 0)
          REACHED_END = false;
          ANIMATING = false;
        }
      })
    }, 50);

  };

  function outerCurve(height) {
    var FRICTION_HEIGHT = height * FRICTION;
    var d = "M0 90 Q 161 " + FRICTION_HEIGHT + " 322 90"
    $(CURVE).attr({
      d: d,
      fill: '#8B90B1'
    });
  }

  function createCurve(height) {
    var FRICTION_HEIGHT = height * FRICTION;
    var d = "M-10 90 Q 161 " + FRICTION_HEIGHT + " 332 90"
    $(CURVE).attr('d', d);
  }
});
              
            
!
999px

Console