Pen Settings

HTML

CSS

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

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="Ho">
  <div class="Wr">
    <div class="Sc">
      <div 
        class="Si"
        style="background-image: url(https://images.unsplash.com/photo-1565808065893-e294b359f004?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=634&q=80)"
      >
        <div class="He">
          <span>Category</span>
          <h2>Image 01</h2>
        </div>  
      </div>
      <div 
        class="Si"
        style="background-image: url(https://images.unsplash.com/photo-1565900102781-a655af2dd585?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=634&q=80)"
      >
        <div class="He">
          <span>Category</span>
          <h2>Image 02</h2>
        </div>  
      </div>
      <div 
        class="Si"
        style="background-image: url(https://images.unsplash.com/flagged/photo-1565751277597-24c0ad1ac283?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1534&q=80)"
      >
        <div class="He">
          <span>Category</span>
          <h2>Image 03</h2>
        </div>  
      </div>
      <div 
        class="Si"
        style="background-image: url(https://images.unsplash.com/photo-1565791930583-f237acdcdd12?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=700&q=80)"
      >
        <div class="He">
          <span>Category</span>
          <h2>Image 04</h2>
        </div>  
      </div>
      <div class="Fo">
        Footer
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                body
  margin 0
  padding 0
  height 100vh
  width 100vw
  font-size 13px
  font-family 'Helvetica', sans-serif

.Ho
  position fixed
  height 667px
  width 375px
  top 5vh
  overflow: hidden;
  right auto
  bottom 5vh
  left calc(50% - 187.5px)
  z-index 1

.Wr
  position relative
  width 375px
  overflow hidden

.Sc
  height ((500*4) + 167)*1px
  width 375px

.Si,
.Fo
  position relative
  height 500px
  width 375px
  background-repeat no-repeat
  background-size 740px auto
  background-position 50% 50%
  overflow hidden

.Si
  .He
    position absolute
    right 0
    bottom 0
    left 0
    padding 10px 6px 5px 6px
    color white
    background linear-gradient(to bottom, rgba(0,0,0,0) 10%, rgba(0,0,0,.9))
    text-align left
    h2
      margin-top .6rem

.Fo
  height 167px
  padding 0 6px
  color white
  background-color red
  display flex
  align-items center
              
            
!

JS

              
                const points = [0, -500, -1000, -1500]

Draggable.create(".Wr", {
      type: 'y',
      bounds: ".Ho",
      throwProps: true,
      dragClickables: true,
      //autoScroll: 0,
      //edgeResistance: 0.75,
      dragResistance: .2,
      minDuration: .4,
      maxDuration: .8,
      snap: { y: points },
      onThrowUpdate: function(){
        let vy = 50 - (this.y / 40)
        TweenMax.to(".Si", .6, {
          backgroundPositionY: `${vy}%`,
          '-webkit-background-position-y': `${vy}%`
        })
      }
    })
              
            
!
999px

Console