cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Multiplane Demo</title>
  </head>
  <body>

    <div id="environment">
      <div id="content">
        <section id="first"></section>
        <section id="second"></section>
        <section id="third"></section>
        <section id="fourth"></section>
      </div>
    </div>

    <div id="scroll-proxy"></div>

<!--    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>-->
  </body>
</html>
            
          
!
            
              /*
 * HTML5 Boilerplate
 *
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html,
button,
input,
select,
textarea {
    color: #222;
}

body {
    font-size: 1em;
    line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight: h5bp.com/i
 * These selection rule sets have to be separate.
 * Customize the background color to match your design.
 */

::-moz-selection {
    background: #b3d4fc;
    text-shadow: none;
}

::selection {
    background: #b3d4fc;
    text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid #ccc;
    margin: 1em 0;
    padding: 0;
}

/*
 * Remove the gap between images and the bottom of their containers: h5bp.com/i/440
 */

img {
    vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
    resize: vertical;
}



/********************
BASE STYLING
********************/

html, body {
  height: 100%;
}

#content {
  position: absolute;
  width: 100%;
  height: 100%; 
}

body {
  background: #D9FCFF;
}



/********************
MAGIC
********************/

#scroll-proxy { height: 4000px; }

#content section {
  width: 100%;
  height: 100%;
  position: absolute;
  background-size: 100%;
  background-color: transparent;
  background-position: center bottom;
  background-repeat: no-repeat;
}

#environment {
  position: fixed;
  width: 100%;
  height: 100%;
  -webkit-perspective: 800px;
     -moz-perspective: 800px;
      -ms-perspective: 800px;
       -o-perspective: 800px;
          perspective: 800px;
}

#content {
  -webkit-transform-style: preserve-3d;
     -moz-transform-style: preserve-3d;
      -ms-transform-style: preserve-3d;
       -o-transform-style: preserve-3d;
          transform-style: preserve-3d;
}

#first {
  background-image: url(https://treehouse-codepen.s3.amazonaws.com/multiplane/landscape1.svg);
  -webkit-transform: translate3d( 0, 0, -11500px) scale(16);
     -moz-transform: translate3d( 0, 0, -11500px) scale(16);
      -ms-transform: translate3d( 0, 0, -11500px) scale(16);
       -o-transform: translate3d( 0, 0, -11500px) scale(16);
          transform: translate3d( 0, 0, -11500px) scale(16);
}

#second {
  background-image: url(https://treehouse-codepen.s3.amazonaws.com/multiplane/landscape2.svg);
  -webkit-transform: translate3d( 0, 0, -24000px ) scale(32);
     -moz-transform: translate3d( 0, 0, -24000px ) scale(32);
      -ms-transform: translate3d( 0, 0, -24000px ) scale(32);
       -o-transform: translate3d( 0, 0, -24000px ) scale(32);
          transform: translate3d( 0, 0, -24000px ) scale(32);
}

#third {
  background-image: url(https://treehouse-codepen.s3.amazonaws.com/multiplane/landscape3.svg);
  -webkit-transform: translate3d( 0, 0, -48000px ) scale(64);
     -moz-transform: translate3d( 0, 0, -48000px ) scale(64);
      -ms-transform: translate3d( 0, 0, -48000px ) scale(64);
       -o-transform: translate3d( 0, 0, -48000px ) scale(64);
          transform: translate3d( 0, 0, -48000px ) scale(64);
}

#fourth {
  background-image: url(https://treehouse-codepen.s3.amazonaws.com/multiplane/landscape4.svg);
  -webkit-transform: translate3d( 0, 0, -64000px ) scale(128);
     -moz-transform: translate3d( 0, 0, -64000px ) scale(128);
      -ms-transform: translate3d( 0, 0, -64000px ) scale(128);
       -o-transform: translate3d( 0, 0, -64000px ) scale(128);
          transform: translate3d( 0, 0, -64000px ) scale(128);
}

            
          
!
            
              (function( window, document, $, Modernizr ){

  var transformProp = Modernizr.prefixed('transform');
  
  // Multiplane constructor
  function Multiplane() {
    // properties
    this.scrolled = 0;
    this.distance3d = 6000;
    
    // cache some jQuery objects
    this.$window = $(window);
    this.$document = $(document);
    
    // bind constructor to window.scroll event
    window.addEventListener( 'scroll', this, false);
  }
  
  // enables constructor to be used within event listener
  // like obj.addEventListener( eventName, this, false )
  Multiplane.prototype.handleEvent = function( event ) {
    if ( this[event.type] ) {
      this[event.type](event);
    }
  };
  
  Multiplane.prototype.scroll = function( event ) {
    // normalize scroll value from 0 to 1
    this.scrolled = this.$window.scrollTop() / ( this.$document.height() - this.$window.height() );
    this.transformScroll( this.scrolled );
  };

  // apply transform to content based on scroll position
  Multiplane.prototype.transformScroll = function( scroll ) {
    var style = {};
    style[ transformProp ] = 'translate3d( 0, 0,' + ( scroll * this.distance3d ) + 'px )';
    this.$content.css( style );
  };
  
  $(function(){
    var env = new Multiplane();
    env.$content = $('#content');
  });

})( window, window.document, window.jQuery, window.Modernizr );
            
          
!
999px
Loading ..................

Console