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="esg-container" class="scrolltrigger">
  
  <div class="container-fluid panel sustain">
    <div class="jumbotron row" style="background-image: url('https://source.unsplash.com/1600x900/?recycle,sustain');">
      <h1 class="display-4">#CBLSustainability</h1>
    </div>
    <div class="row">
      <div class="col-md-6">
       <h2>Sustainability</h2>
        <p>I'm baby art party kickstarter ut humblebrag brooklyn duis. Vape kickstarter ethical iceland skateboard glossier gentrify semiotics bicycle rights. Chambray pitchfork affogato street art irony est exercitation beard dreamcatcher. Skateboard dolore id, air plant wolf disrupt scenester freegan copper mug voluptate tattooed. Hella XOXO pabst marfa, in tote bag officia single-origin coffee swag try-hard knausgaard.</p>
      </div>
      <div class="col-md-6" style="background-image: url('https://source.unsplash.com/1600x900/?shopping,recycling');"></div>
    </div>
    <div id="arrow" class="row">
      <div class="scroll-down">Scroll down<div class="arrow"><i class="fas fa-arrow-down animated faa-bounce faa-reverse"></i></div></div>
    </div>
  </div>
  
  <section class="container-fluid panel responsibility">
    <div class="jumbotron row" style="background-image: url('https://source.unsplash.com/1600x900/?social,responsible');">
      <h1 class="display-4">#CBLSocialResponsibility</h1>
    </div>
    <div class="row">
      <div class="col-md-6">
       <h2>Social Responsibility</h2>
        <p>I'm baby truffaut skateboard gluten-free echo park typewriter pickled dreamcatcher ennui pug etsy. Bespoke yuccie woke af. Pitchfork mixtape gentrify, tousled iceland synth marfa occupy coloring book celiac sartorial af slow-carb. Brunch XOXO portland, yr enamel pin next level quinoa cloud bread bushwick blue bottle health goth bespoke photo booth pinterest dreamcatcher. Disrupt cred drinking vinegar paleo tote bag. Kitsch plaid cliche, roof party cold-pressed hella shaman photo booth messenger bag deep v prism vice man braid small batch artisan. Fashion axe vegan pour-over 8-bit subway tile 90's artisan echo park schlitz four dollar toast pinterest chartreuse palo santo man bun locavore.</p>
      </div>
      <div class="col-md-6" style="background-image: url('https://source.unsplash.com/1600x900/?people,fun');"></div>
    </div>
  </section>
  
  <section class="container-fluid panel community">
    <div class="jumbotron row" style="background-image: url('https://source.unsplash.com/1600x900/?community,helping');">
      <h1 class="display-4">#CBLCommunity</h1>
    </div>
    <div class="row">
      <div class="col-md-6">
       <h2>Community Impact</h2>
        <p>Literally sartorial ramps four dollar toast fingerstache bitters blog gastropub scenester mustache artisan shoreditch yuccie kale chips yr. Neutra adaptogen dreamcatcher knausgaard cornhole humblebrag, authentic palo santo letterpress next level hexagon green juice affogato gochujang direct trade. Schlitz vice bespoke, lumbersexual jianbing iceland narwhal brooklyn chicharrones normcore. Meh swag vinyl heirloom fixie man braid pop-up bicycle rights succulents palo santo fashion axe kinfolk photo booth. Mumblecore gentrify vexillologist, forage snackwave +1 skateboard tumeric mixtape vegan kickstarter health goth la croix.</p>
      </div>
      <div class="col-md-6" style="background-image: url('https://source.unsplash.com/1600x900/?dogs,cats');"></div>
    </div>
  </section>

</div>
              
            
!

CSS

              
                #esg-container.scrolltrigger {
  width: 300% !important;
  height: 100% !important;
  display: flex;
  flex-wrap: no-wrap;
}

.panel {
  will-change: transform;
}

.jumbotron {
  background-size: cover;
  background-position: center center;
}

.jumbotron h1 {
  color: #fff;
  text-transform: uppercase;
  font-weight: 900;
  padding: 5rem 0;
  width: 100%;
  min-height: 50%;
  text-align: center;
}

.panel h2 {
  color: #00549d;
  text-transform: uppercase;
}

.panel p {
  color: #707070;
}

#arrow {
  text-align: center;
  font-weight: 600;
  font-size: 1.5rem;
}
              
            
!

JS

              
                gsap.registerPlugin(ScrollTrigger);

let duration = 10,
		sections = gsap.utils.toArray(".panel"),
		sectionIncrement = duration / (sections.length - 1),
		tl = gsap.timeline({
			scrollTrigger: {
				trigger: ".scrolltrigger",
				pin: true,
				scrub: 1,
        snap: 1 / (sections.length - 1),
				start: "top top",
				end: "+=5000"
			}
		});

tl.to(sections, {
  xPercent: -100 * (sections.length - 1),
  duration: duration,
  ease: "none"
});



// everything below this is just for the fading/scaling up which is NOT scrubbed - it's all dynamic, triggered when each section enters/leaves so that the fading/scaling occurs at a consistent rate no matter how fast you scroll!
sections.forEach((section, index) => {
  let tween = gsap.from(section, {
    opacity: 0, 
    scale: 0.6, 
    duration: 1, 
    force3D: true, 
    paused: true
  });
  addSectionCallbacks(tl, {
    start: sectionIncrement * (index - 0.99),
    end: sectionIncrement * (index + 0.99),
    onEnter: () => tween.play(),
    onLeave: () => tween.reverse(),
    onEnterBack: () => tween.play(),
    onLeaveBack: () => tween.reverse()
  });
  index || tween.progress(1); // the first tween should be at its end (already faded/scaled in)
});





// helper function that lets us define a section in a timeline that spans between two times (start/end) and lets us add onEnter/onLeave/onEnterBack/onLeaveBack callbacks
function addSectionCallbacks(timeline, {start, end, param, onEnter, onLeave, onEnterBack, onLeaveBack}) {
  let trackDirection = animation => { // just adds a "direction" property to the animation that tracks the moment-by-moment playback direction (1 = forward, -1 = backward)
    let onUpdate = animation.eventCallback("onUpdate"), // in case it already has an onUpdate
        prevTime = animation.time();
    animation.direction = animation.reversed() ? -1 : 1;
    animation.eventCallback("onUpdate", () => {
      let time = animation.time();
      if (prevTime !== time) {
        animation.direction = time < prevTime ? -1 : 1;
        prevTime = time;
      }
      onUpdate && onUpdate.call(animation);
    });
  },
      empty = v => v; // in case one of the callbacks isn't defined
  timeline.direction || trackDirection(timeline); // make sure direction tracking is enabled on the timeline
  start >= 0 && timeline.add(() => ((timeline.direction < 0 ? onLeaveBack : onEnter) || empty)(param), start);
  end <= timeline.duration() && timeline.add(() => ((timeline.direction < 0 ? onEnterBack : onLeave) || empty)(param), end);
}



              
            
!
999px

Console