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 id="curtain">Curtain
</div>

<div id="content">
  <div class="content-inner">
    <h3>Content </h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id elit elit. </p>
    <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
    <h3>Condimentum justo </h3>

    <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
    <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
    <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
    <h3>Condimentum justo </h3>

    <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
    <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
    <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
  </div>

  <div id="columns">
    <div class="left">
      <h3>More Content </h3>

      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id elit elit. </p>
      <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id elit elit. </p>
      <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id elit elit. </p>
      <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id elit elit. </p>
      <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id elit elit. </p>
      <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id elit elit. </p>
      <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id elit elit. </p>
      <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id elit elit. </p>
      <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id elit elit. </p>
      <p>Vivamus faucibus cursus quam sed malesuada. Vestibulum et massa facilisis, pulvinar justo non, vestibulum turpis.</p>
      <p> Morbi id condimentum justo, et condimentum tellus. Proin elementum commodo erat vel sodales. </p>

    </div>
    <div class="right">Sticky Bar 100vh</div>

  </div>

</div>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
}
body {
  margin: 0;
  padding: 0;
}

#curtain {
  background: yellow;
  height: 50vh;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  width: 100%;
  font-family: helvetica;
  font-size: 24px;
  padding: 20px;
}
.content-inner {
  padding: 20px;
}
#content {
  background: grey;
  display: block;
}
p {
  margin-bottom: 6px;
  font-family: helvetica;
  font-size: 18px;
  line-height: 22px;
  max-width: 560px;
}

h3 {
  margin-bottom: 12px;
  margin-top: 24px;
  font-family: helvetica;
  font-size: 24px;
  line-height: 26px;
  font-weight: normal;
  margin-bottom: 12px;
}

#columns {
  display: flow-root;
  background: red;
  width: 100%;
}
.left {
  width: calc(50% - 40px);
  float: left;
  display: block;
  padding: 20px;
}
.right {
  width: calc(50% - 40px);
  float: right;
  background: #1a1a1a;
  height: 100vh;
  display: block;
/*   position: sticky; */
  top: 0;
  right: 0;
  font-family: helvetica;
  font-size: 18px;
  line-height: 22px;
  color: white;
  font-family: helvetica;
  font-size: 24px;
  line-height: 26px;
  padding: 20px;
}

              
            
!

JS

              
                gsap.registerPlugin(ScrollTrigger);

ScrollTrigger.create({
  trigger: "#content",
  start: "top top",
  endTrigger: "#curtain",
  end: "bottom top",
  scrub: true,
  pin: true,
  // markers: true,
  pinSpacing: false
});

ScrollTrigger.create({
  trigger: ".right",
  start: "top top",
  end: "max",
  pinnedContainer: "#content",
  pinType: "transform", // because it's inside an element with transforms applied, thus position: fixed won't work the way you may anticipate.
  onRefreshInit: self => self.scroll(0), // if the user is scrolled beyond the container pin, it throws off the measurements, so just scroll to the top to ensure positioning is correct.
  pin: true
});


              
            
!
999px

Console