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

              
                <!-- idea from http://part.archi -->
<section class="top">
  <div class="content">
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti consequuntur aut nihil exercitationem earum itaque tenetur asperiores vel odio eveniet, nisi quidem, ullam quos vero at iusto facilis, id maxime?
    </p>
    <img src="https://images.unsplash.com/photo-1519406155028-39dbcdf8400c?ixlib=rb-1.2.1&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ" alt="">
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti consequuntur aut nihil exercitationem earum itaque tenetur asperiores vel odio eveniet, nisi quidem, ullam quos vero at iusto facilis, id maxime?
    </p>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti consequuntur aut nihil exercitationem earum itaque tenetur asperiores vel odio eveniet, nisi quidem, ullam quos vero at iusto facilis, id maxime?
    </p>
  </div>
</section>
<section class="back">
  <div class="content">
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti consequuntur aut nihil exercitationem earum itaque tenetur asperiores vel odio eveniet, nisi quidem, ullam quos vero at iusto facilis, id maxime?
    </p>
    <img src="https://images.unsplash.com/photo-1519406155028-39dbcdf8400c?ixlib=rb-1.2.1&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ" alt="">
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti consequuntur aut nihil exercitationem earum itaque tenetur asperiores vel odio eveniet, nisi quidem, ullam quos vero at iusto facilis, id maxime?
    </p>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti consequuntur aut nihil exercitationem earum itaque tenetur asperiores vel odio eveniet, nisi quidem, ullam quos vero at iusto facilis, id maxime?
    </p>
  </div>
</section>
<section class="bottom">
  <div class="content">
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti consequuntur aut nihil exercitationem earum itaque tenetur asperiores vel odio eveniet, nisi quidem, ullam quos vero at iusto facilis, id maxime?
    </p>
    <img src="https://images.unsplash.com/photo-1519406155028-39dbcdf8400c?ixlib=rb-1.2.1&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ" alt="">
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti consequuntur aut nihil exercitationem earum itaque tenetur asperiores vel odio eveniet, nisi quidem, ullam quos vero at iusto facilis, id maxime?
    </p>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti consequuntur aut nihil exercitationem earum itaque tenetur asperiores vel odio eveniet, nisi quidem, ullam quos vero at iusto facilis, id maxime?
    </p>
  </div>

</section>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Lato:400,400i,700");

* {
  box-sizing: border-box;
}

body {
  font-family: Lato, sans-serif;
  font-size: 6vh; // big, big, big
  line-height: 1.3;
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  perspective: 100vw;
  transform-style: preserve-3d;
}

section {
  position: absolute;
  width: 100%;
  height: 100vh;
  border: 1px solid #1d1d1d;
  padding: 0 5vh;
  overflow: hidden;
}

.back {
  transform: translateZ(-50vh);
}

.top {
  transform: rotateX(-90deg) translateZ(-50vh);
}

.bottom {
  transform: rotateX(90deg) translateZ(-50vh);
}

.content {
  position: relative;
  width: 100%;
  height: 100vh;
}

p {
  max-width: 60%;
  margin: 0 auto 2em;
}

img {
  max-width: 100%;
  margin: 1em 0;
}


.top .content {
  top: 100vh;
}

.bottom .content {
  bottom: 105vh;
}
              
            
!

JS

              
                // Thank you, Sarah! (updated event handler)
// https://codepen.io/SarahC
//
// https://developer.mozilla.org/en-US/docs/Web/Events/wheel#Listening_to_this_event_across_browser
// creates a global "addWheelListener" method
// example: addWheelListener( elem, function( e ) { console.log( e.deltaY ); e.preventDefault(); } );
(function(window,document) {
  var prefix = "", _addEventListener, support;
  // detect event model
  if ( window.addEventListener ) {
    _addEventListener = "addEventListener";
  } else {
    _addEventListener = "attachEvent";
    prefix = "on";
  }
  // detect available wheel event
  support = "onwheel" in document.createElement("div") ? "wheel" : // Modern browsers support "wheel"
  document.onmousewheel !== undefined ? "mousewheel" : // Webkit and IE support at least "mousewheel"
  "DOMMouseScroll"; // let's assume that remaining browsers are older Firefox
  window.addWheelListener = function( elem, callback, useCapture ) {
    _addWheelListener( elem, support, callback, useCapture );
    // handle MozMousePixelScroll in older Firefox
    if( support == "DOMMouseScroll" ) {
      _addWheelListener( elem, "MozMousePixelScroll", callback, useCapture );
    }
  };
  function _addWheelListener( elem, eventName, callback, useCapture ) {
    elem[ _addEventListener ]( prefix + eventName, support == "wheel" ? callback : function( originalEvent ) {
      !originalEvent && ( originalEvent = window.event );
      // create a normalized event object
      var event = {
        // keep a ref to the original event object
        originalEvent: originalEvent,
        target: originalEvent.target || originalEvent.srcElement,
        type: "wheel",
        deltaMode: originalEvent.type == "MozMousePixelScroll" ? 0 : 1,
        deltaX: 0,
        deltaY: 0,
        deltaZ: 0,
        preventDefault: function() {
          originalEvent.preventDefault ?
            originalEvent.preventDefault() :
          originalEvent.returnValue = false;
        }
      };
      // calculate deltaY (and deltaX) according to the event
      if ( support == "mousewheel" ) {
        event.deltaY = - 1/40 * originalEvent.wheelDelta;
        // Webkit also support wheelDeltaX
        originalEvent.wheelDeltaX && ( event.deltaX = - 1/40 * originalEvent.wheelDeltaX );
      } else {
        event.deltaY = originalEvent.deltaY || originalEvent.detail;
      }
      return callback( event );
    }, useCapture || false );
  }
})(window,document);

var topE = document.querySelector(".top .content");
var bottomE = document.querySelector(".bottom .content");
var backE = document.querySelector(".back .content");

addWheelListener(window, function (e) {
  var scrolled = parseInt(e.deltaY * 1.5);
  var currTop = parseInt(window.getComputedStyle(topE).top.split("px")[0]);
  var currBottom = parseInt(window.getComputedStyle(bottomE).bottom.split("px")[0]);
  var currBack = parseInt(window.getComputedStyle(backE).bottom.split("px")[0]);
  TweenMax.to(topE.style, 0.3, {top: currTop - scrolled + "px" });
  TweenMax.to(backE.style, 0.3, {bottom: currBack + scrolled + "px" });
  TweenMax.to(bottomE.style, 0.3, {bottom: currBottom + scrolled + "px" });
  e.preventDefault();
});

              
            
!
999px

Console