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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="parallax">
  <div class="parallax-layer one">
    <p>Scroll for Effect</p>
  </div><div class="parallax-layer two">
    <p>Scroll for Effect</p>
  </div><div class="parallax-layer three">
    <p>Scroll for Effect</p>
  </div><div class="parallax-layer four">
    <p>Scroll for Effect</p>
  </div><div class="parallax-layer five">
    <p>Scroll for Effect</p>
  </div><div class="parallax-layer six">
    <p>Scroll for Effect</p>
  </div><div class="parallax-layer seven">
    <p>Scroll for Effect</p>
  </div><div class="parallax-layer eight">
    <p>Scroll for Effect</p>
  </div><div class="parallax-layer nine">
    <p>Scroll for Effect</p>
  </div><div class="parallax-layer ten">
    <p>Scroll for Effect</p>
  </div>
</div>
              
            
!

CSS

              
                body {
  background: #1d1f20;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
	font-size: 24px;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.parallax {
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-perspective: 1px;
  perspective: 1px;
}

.parallax-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 100vh;
  white-space: nowrap;
}

.parallax-layer.one {
  color: #ccc;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.parallax-layer.two {
  color: #bbb;
  -webkit-transform: translateZ(-.25px);
  transform: translateZ(-.25px);
}

.parallax-layer.three {
  color: #aaa;
  -webkit-transform: translateZ(-.5px);
  transform: translateZ(-.5px);
}

.parallax-layer.four {
  color: #999;
  -webkit-transform: translateZ(-.75px);
  transform: translateZ(-.75px);
}

.parallax-layer.five {
  color: #888;
  -webkit-transform: translateZ(-1px);
  transform: translateZ(-1px);
}

.parallax-layer.six {
  color: #777;
  -webkit-transform: translateZ(-1.25px);
  transform: translateZ(-1.25px);
}

.parallax-layer.seven {
  color: #666;
  -webkit-transform: translateZ(-1.5px);
  transform: translateZ(-1.5px);
}

.parallax-layer.eight {
  color: #555;
  -webkit-transform: translateZ(-1.75px);
  transform: translateZ(-1.75px);
}

.parallax-layer.nine {
  color: #444;
  -webkit-transform: translateZ(-2px);
  transform: translateZ(-2px);
}

.parallax-layer.ten {
  color: #333;
  -webkit-transform: translateZ(-2.25px);
  transform: translateZ(-2.25px);
}
              
            
!

JS

              
                ////////////////////
// Automate UI
////////////////////

(function() {

  var parallaxObj, scrollToThis, interval;

  parallaxObj = $('.parallax');
  scrollToThis = parallaxObj.height();

  function scroll() {

    parallaxObj.animate({
      scrollTop: scrollToThis
    }, 2000);
    
    if(scrollToThis === 0){
      scrollToThis = parallaxObj.height();
    }else{
      scrollToThis = 0;
    }
  }
  
  scroll();

  interval = setInterval(function() {
    scroll();
  }, 2000);
  
  $('body').on('mouseover', function(){
    clearInterval(interval);
  });

}());
              
            
!
999px

Console