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 style="min-height:600px;">
  scroll down
</div>

<div class="section shg">
      <div class="containerdiv chg">
        <div class="html-embed-2 w-embed">
          <div class="content-container">


            <div class="left-content">

              <img id="img1" class="imageToShow" src="https://assets.website-files.com/5f369e90e946a4c5add5fc1a/5f3d850c2c39379303de0a17_camion%20poster.png">
              <img id="img2" class="imageToShow" src="https://assets.website-files.com/5f369e90e946a4c5add5fc1a/5f3d850c8947f9d2f61724d0_shutterstock_447317020.png">
              <img id="img3" class="imageToShow" src="https://assets.website-files.com/5f369e90e946a4c5add5fc1a/5f3fde6487584b24a32bac96_shutterstock_254033086-901x644.jpg">

            </div>



            <div class="right-content">


              <p class="contentMarker" data-marker-content="img1">

                <div class="div-block-14">
                  <div class="div-block-15"><img src="https://assets.website-files.com/5f369e90e946a4c5add5fc1a/5f3d8504ac5bfcd0938b8d61_logorose.png" loading="lazy" width="58" alt="" />
                    <div class="div-block-16">
                      <h2 class="heading-4">Next-day tailor-made deliveries</h2>
                      <div>We ensure a fast, efficient, personalized delivery to all of our clients.</div>
                    </div>
                  </div>
                  <div class="text-block-4">Scroll to discover</div>
                  <div class="div-block-17"></div>
                </div>

              </p>


              <p class="contentMarker" data-marker-content="img2">

                <div class="div-block-14">
                  <div class="div-block-15"><img src="https://assets.website-files.com/5f369e90e946a4c5add5fc1a/5f3d8505c29630026af34b2c_Group%203.png" loading="lazy" width="58" alt="" />
                    <div class="div-block-16">
                      <h2 class="heading-4">100% green</h2>
                      <div>All of our vehicles are electric.<br/>Furthermore, we reduce environmental impact thanks to our City-Hub network created for optimized logistics and deliveries. </div>
                    </div>
                  </div>
                </div>

              </p>


              <p class="contentMarker" data-marker-content="img3">

                <div class="div-block-14">
                  <div class="div-block-15"><img src="https://assets.website-files.com/5f369e90e946a4c5add5fc1a/5f4e821ac1739e3df0a2ea48_grey.png" loading="lazy" width="58" alt="" />
                    <div class="div-block-16">
                      <h2 class="heading-4">Dignity for our workforce</h2>
                      <div>We believe in workforce empowerment.<br/>Not only are our employees paid by the hour, we encourage internal mobility and provide great benefit packages.</div>
                    </div>
                  </div>
                </div>

              </p>


            </div>
          </div>
        </div>
      </div>
    </div>


<div style="min-height:600px;">
  scroll up
</div>
              
            
!

CSS

              
                .content-container {
        display: flex;
      }

      .content-container>* {
        flex-basis: 100%;
      }

      .right-content {
        padding-right: 15px;
        padding-left: 10%;
      }

      .left-content {
        height: 100vh;
        position: relative;
      }

      .left-content>* {
        position: absolute;
        left: 50%;
        top: 50%;
        opacity: 0;
        visibility: hidden;
      }

      .imageToShow {
        min-width: 100%;
        min-height: 100%;
      }

      @media screen and (max-width: 800px) {
        .left-content {
          display: none;
        }
        .right-content {
          padding-left: 15px;
        }
      }


.div-block-14 {
        height: 100vh;
        justify-content: center;
      }
              
            
!

JS

              
                console.clear();

      gsap.defaults({
        overwrite: 'auto'
      });

      gsap.set(".left-content > *", {
        xPercent: -50,
        yPercent: -50
      });

      // Set up our scroll trigger
      const ST = ScrollTrigger.create({
        trigger: ".content-container",
        start: "top top",
        end: "bottom bottom",
        onUpdate: getCurrentSection,
        pin: ".left-content"
      });

      const contentMarkers = gsap.utils.toArray(".contentMarker");

      // Set up our content behaviors
      contentMarkers.forEach(marker => {
        marker.content = document.querySelector(`#${marker.dataset.markerContent}`);

        if (marker.content.tagName === "IMG") {
          gsap.set(marker.content, {
            transformOrigin: "center"
          });

          marker.content.enter = function() {
            gsap.fromTo(marker.content, {
              autoAlpha: 0,
              rotateY: -30
            }, {
              duration: 0.3,
              autoAlpha: 1,
              rotateY: 0
            });
          }
        } else if (marker.content.tagName === "BLOCKQUOTE") {
          gsap.set(marker.content, {
            transformOrigin: "left center"
          });

          marker.content.enter = function() {
            gsap.fromTo(marker.content, {
              autoAlpha: 0,
              rotateY: 50
            }, {
              duration: 0.3,
              autoAlpha: 1,
              rotateY: 0
            });
          }
        }

        marker.content.leave = function() {
          gsap.to(marker.content, {
            duration: 0.1,
            autoAlpha: 0
          });
        }

      });

      // Handle the updated position
      let lastContent;

      function getCurrentSection() {
        let newContent;
        const currScroll = scrollY;

        // Find the current section
        contentMarkers.forEach(marker => {
          if (currScroll > marker.offsetTop) {
            newContent = marker.content;
          }
        });

        // If the current section is different than that last, animate in
        if (newContent &&
          (lastContent == null ||
            !newContent.isSameNode(lastContent))) {
          // Fade out last section
          if (lastContent) {
            lastContent.leave();
          }

          // Animate in new section
          newContent.enter();

          lastContent = newContent;
        }

      }

      const media = window.matchMedia("screen and (max-width: 600px)");
      ScrollTrigger.addEventListener("refreshInit", checkSTState);
      checkSTState();

      function checkSTState() {
        if (media.matches) {
          ST.disable();
        } else {
          ST.enable();
        }
      }
              
            
!
999px

Console