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.

            
              .wrapper
  .scroll-list
    .scroll-list__wrp.js-scroll-content.js-scroll-list
      - for (i = 0; i <= 55; i++)
        .scroll-list__item.js-scroll-list-item
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Roboto:400,500,700,900&subset=latin-ext');

html {
  position: relative;
  overflow-x: hidden !important;
}

body {
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  background: #f2f7fd;
}

a, a:hover {
  text-decoration: none;
}

* {
  box-sizing: border-box;
}

.wrapper {
  display: flex;
  align-items: center;
  min-height: 100vh;
  //background-color: #FA8BFF;
  //background-image: linear-gradient(45deg, #FA8BFF 0%, #2BD2FF 52%, #2BFF88 90%);
  //background-image: linear-gradient(45deg, #d4145a, #fbb03b);
     background-image: linear-gradient(-225deg, #231557 0%, #44107A 29%, #FF1361 67%, #fa9b48 100%);
}

.scroll-list {
  width: 100%;
  max-width: 700px;
  padding: 25px;
  margin-top: 50px;
  margin-left: auto;
  margin-right: auto;

  @media screen and (max-width: 768px) {
    margin-top: 20px
  }
  
  &__wrp {
    width: 100%;
    height: 700px;
    overflow: auto;
    padding: 50px;
 box-shadow: 0px 7px 46px 0px rgba(41, 53, 108, 0.45);
    background: #4b1079;
    background: #4b1079;
    margin-bottom: 15px;
    border-radius: 8px;
    background-image: linear-gradient(147deg, #6e0777 0%, #380c70 74%);
    .scrollbar-track {
      display: none!important;
    }

    @media screen and (max-width: 768px) {
      padding: 25px;
    }

  }

  &__item {
    width: 100%;
    height: 155px;
    display: block;
    margin-bottom: 15px;
    border-radius: 8px;
    background-image: linear-gradient(147deg, #ff7c34 0%, #c31269 74%);
    transition: all .35s ease-in-out;
    opacity: 0;
    transform: scale(0.7);
    box-shadow: 0px 7px 16px 0px rgba(41,53,108,0.25);

    &.item-hide {
      opacity: 0;
      transform: scale(.7);
    }

    &.item-focus {
      opacity: 1;
      transform: scale(1);
    }

    &.item-next {
      opacity: 1;
      transform: scale(1);

      & + .scroll-list__item {
        opacity: 1;
        transform: scale(1);
      }

    }

    &:last-child {
      margin-bottom: 155px;
    }

    //@media screen and (max-width: 768px) {
    //  width: 450px;
    //  margin-bottom: 0;
    //  margin-right: 15px;
    //  flex-shrink: 0;
    //  opacity: 1 !important;
    //  transform: none!important;
    //
    //  &:last-child {
    //    margin-bottom: 0;
    //    margin-right: 50px;
    //  }
    //
    //}

  }

}












            
          
!
            
              $(document).ready(function () {
  var Scrollbar = window.Scrollbar;

  Scrollbar.use(window.OverscrollPlugin);

  var customScroll = Scrollbar.init(document.querySelector('.js-scroll-list'), {
    plugins: {
      overscroll: true
    }
  });

  var listItem = $('.js-scroll-list-item');

  listItem.eq(0).addClass('item-focus');
  listItem.eq(1).addClass('item-next');

  customScroll.addListener(function (status) {

    var $content = $('.js-scroll-content');

    var viewportScrollDistance = 0;


    viewportScrollDistance = status.offset.y;
    var viewportHeight = $content.height();
    var listHeight = 0;
    var $listItems = $content.find('.js-scroll-list-item');
    for (var i = 0; i < $listItems.length; i++) {
      listHeight += $($listItems[i]).height();
    }

    var top = status.offset.y;
    // console.log(top);
    var visibleCenterVertical = 0;
    visibleCenterVertical = top;

    var parentTop = 1;
    var $lis = $('.js-scroll-list-item');
    var $focusLi;
    for (var i = 0; i < $lis.length; i++) {
      var $li = $($lis[i]);
      var liTop = $li.position().top;
      var liRelTop = liTop - parentTop;

      var distance = 0;
      var distance = Math.abs(top - liRelTop);
      var maxDistance = $('.js-scroll-content').height() / 2;
      var distancePercent = distance / (maxDistance / 100);


      if (liRelTop + $li.parent().scrollTop() > top) {
        if (!$li.hasClass('item-focus')) {
          $li.prev().addClass('item-hide');
          $lis.removeClass('item-focus');
          $lis.removeClass('item-next');
        }
        $li.removeClass('item-hide');
        $li.addClass('item-focus');
        $li.next().addClass('item-next');
        break;
      }
    }
  });

});
            
          
!
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