Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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>
  <div class="container">
    <div class="panel blue">1500px</div>
    <div class="panel orange">
      <h1>height is based on content</h1>

      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed ligula arcu. Pellentesque rutrum, eros a tempus convallis, nisl nisi cursus tellus, id vehicula enim felis sed tellus. Curabitur at urna vitae urna convallis semper tincidunt et mauris. Ut ac dui hendrerit, viverra sapien ac, tincidunt libero. Fusce ac eleifend tellus. Integer ut purus at odio ornare tristique id sed ex. Ut luctus enim a libero aliquet, quis rhoncus lacus interdum. Sed ornare cursus augue, eu auctor enim.

        Vestibulum erat urna, cursus a eros eu, dignissim ultrices leo. Donec finibus mauris at orci cursus, sed sollicitudin purus vestibulum. Donec lacinia auctor nunc quis interdum. Sed lobortis eros nec ultricies sodales. Aenean vitae sodales lectus. Aliquam erat volutpat. In convallis tempus tempor.

        In vulputate risus ut arcu faucibus, vel rhoncus orci tempus. Mauris porta, arcu vel vulputate tempus, neque dolor finibus orci, vitae luctus ante sapien in lectus. Pellentesque viverra blandit ipsum eget ultrices. Sed consectetur porta blandit. Nullam commodo leo vel scelerisque iaculis. Nunc ultricies ante tincidunt placerat aliquet. Vivamus pretium tellus ac magna lacinia ornare. Nam aliquet purus id massa vestibulum, ut auctor augue consectetur. Aliquam erat volutpat. Curabitur fermentum malesuada justo, at eleifend nulla condimentum at.

        In urna metus, sodales at blandit sed, eleifend at orci. Donec tempor in purus a finibus. Donec nec metus cursus neque venenatis dapibus maximus at orci. Ut id metus porttitor, dapibus erat et, lobortis dolor. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Duis vulputate congue urna at viverra. Phasellus finibus porttitor dui et lobortis. In finibus ligula vitae congue dapibus. Vivamus malesuada tellus risus, ac hendrerit leo pretium eu.

        Cras lobortis ligula tempor sagittis semper. In cursus rhoncus rhoncus. Cras id felis quis ex ullamcorper cursus a sollicitudin tellus. Mauris nec volutpat magna. Aliquam lobortis dolor consectetur condimentum euismod. Cras tincidunt lectus dictum ultricies gravida. Integer sit amet tellus aliquet sem tempus commodo vel at mauris. Aenean at feugiat nisi. Aenean scelerisque nisl vitae lacinia dignissim.</p>

    </div>
    <div class="panel yellow">1600px</div>
    <div class="panel">
    <div class="video">
      <div class="box"></div>
    </div>  </div>
    <div class="panel purple">100vh</div>
    <div class="panel red">100vh</div>
    <div class="panel purple">100vh</div>
  </div>
</div>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
.container {
  height: 100%;
  width: 100%;
  position: relative;
}

.logger {
  position: fixed;
  top: 40px;
  right: 0;
  width: 120px;
  background: rgba(0, 0, 0, 1);
  color: white;
  border: 2px solid #af4261;
  padding: 10px;
  font-size: 12px;
}

.panel {
  border: 1px dashed black;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: red;
  background: linear-gradient(0deg, #f3ec78, #af4261);
  font-size: 3rem;
  padding: 3rem;
}

.blue {
  height: 1500px;
  background: linear-gradient(0deg, #020c56, blue);
}

.orange {
  background: linear-gradient(0deg, #fa6800, orange);
  display: flex;
  flex-direction: column;
}

.yellow {
  height: 1600px;
  background: linear-gradient(0deg, #f3ec78, yellow);
}

.purple {
  height: 100vh;
  font-size: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.red {
  height: 100vh;
  background: linear-gradient(0deg, #f3ec78, red);
  font-size: 20px;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lightBlue {
  height: "100%";
  background: linear-gradient(0deg, #00b4db, rgb(9, 103, 134));
  display: flex;
  flex-direction: column;
  position: relative;
}

.lightGreen {
  height: "100%";
  background: linear-gradient(0deg, #086202, rgb(153, 231, 120));
  display: flex;
  flex-direction: column;
  /* position: relative; */
}

.line {
  width: 100%;
  max-width: 800px;
  height: 8px;
  margin: 0 0 10px 0;
  position: relative;
  display: inline-block;
  background-color: rgba(255, 255, 255, 1);
}

.spacer {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  font-size: 20px;
  height: 1000px;
  background-color: beige;
  opacity: 0.5;
}

.video {
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.box {
  width: 200px;
  height: 200px;
  background-color: red;
}

              
            
!

JS

              
                const panels = gsap.utils.toArray(".panel");

panels.forEach((panel, i) => {
  if (i > 0) {
    gsap.set(panel, {
      y: -window.innerHeight,
      zIndex: -i
    });
    ScrollTrigger.create({
      trigger: panel,
      end: `top+=${window.innerHeight}`,
      pin: true,
      pinSpacing: false,
      markers: {
        startColor: "grey",
        endColor: "darkGrey",
        fontSize: "20px"
      },
      scrub: 1
    });
  }
});

gsap.to(".box", {
  rotation: 360,
  scrollTrigger: {
    trigger: ".video",
    start: "center center",
    end: `+=2000`,
    scrub: true,
    pin: true,
    markers: true
  }
});

// scrolltriggers must be created in the order they appear on the page
ScrollTrigger.sort();

              
            
!
999px

Console