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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <main class="site_wrapper TEST">
  <div id="smooth_wrapper" class="scroll_container">
    <div id="smooth_content" class="work_image_wrapper">
      <div class="initial"></div>
      <div class="image_grid grid-cols-4 md:grid-cols-8">
        <div data-pin="" class="para_wrapper col-start-1 md:col-start-3 col-end-5 md:col-end-9  speed-0">
          <div class="image_wrapper mt-40 mb-16">
          </div>
          <picture>
            <img class="object-cover w-full h-full w-full h-full object-cover" style="object-position: 50% 50%" src="https://images.pexels.com/photos/2662116/pexels-photo-2662116.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2">
          </picture>

        </div>

      </div>
      <div class="image_grid grid-cols-4 md:grid-cols-8">
        <div data-pin="" class="para_wrapper col-start-2 md:col-start-1 col-end-5 md:col-end-5 speed-2">
          <div class="image_wrapper mt-2 mb-2">
            <picture>

              <img class="object-cover w-full h-full w-full h-full object-cover" style="object-position: 50% 50%" src="https://images.pexels.com/photos/3274903/pexels-photo-3274903.jpeg?auto=compress&cs=tinysrgb&w=1600" alt="">

            </picture>

          </div>

        </div>

      </div>
      <div class="image_grid grid-cols-4 md:grid-cols-8">
        <div data-pin="" class="para_wrapper col-start-2 md:col-start-1 col-end-4 md:col-end-5  speed-0" style="transform: translate(0%, -1.0072%) translate3d(0px, 0px, 0px);">
          <div class="image_wrapper mt-2 mb-2">
            <picture>
              <img class="object-cover w-full h-full w-full h-full object-cover" style="object-position: 50% 50%" src="https://images.pexels.com/photos/2753432/pexels-photo-2753432.jpeg?auto=compress&cs=tinysrgb&w=1200&lazy=load" alt="">

            </picture>

          </div>

        </div>
        <div data-pin="" class="para_wrapper col-start-2 md:col-start-5 col-end-5 md:col-end-8  speed-1">
          <div class="image_wrapper mt-40 mb-40">
            <picture>

              <img class="object-cover w-full h-full w-full h-full object-cover" style="object-position: 50% 50%" src="https://images.pexels.com/photos/462024/pexels-photo-462024.jpeg?auto=compress&cs=tinysrgb&w=1600" alt="">

            </picture>

          </div>

        </div>

      </div>

    </div>
  </div>
</main>
              
            
!

CSS

              
                .work_image_wrapper {
  position: relative;
  padding: 0 1rem;
  will-change: transform;
}

#cloned_elem {
   padding: 0;
  }

.image_grid {
  display: grid;
  grid-column-gap: 1rem;
  grid-row-gap: 1rem;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: auto;
  width: 100%;
  position: relative;
}
              
            
!

JS

              
                ScrollTrigger.create({
    start: 0,
    end: "bottom-=200px bottom",
    markers: true,
    onLeave: () => {
      console.log("leave");
      let workWrapper = document.querySelector('.work_image_wrapper');
      let clonedWorkWrapper = workWrapper.cloneNode(true);
      const workPanel = document.querySelector('.scroll_container')
      clonedWorkWrapper.id = 'cloned_elem';
      workPanel.appendChild(clonedWorkWrapper);

      const speed_0 = clonedWorkWrapper.querySelectorAll('.speed-0');
      console.log(0,speed_0)
        gsap.to(speed_0, { 
          yPercent: -100,
          ease: "none",
          scrollTrigger: {
            trigger: speed_0,
            scrub: true
          }
        })

      const speed_1 = clonedWorkWrapper.querySelectorAll('.speed-1');
      console.log(1,speed_1)
        gsap.to(speed_1, { 
          yPercent: -100,
          ease: "none",
          scrollTrigger: {
            trigger: speed_1,
            scrub: true
          }
        })



      const speed_2 = clonedWorkWrapper.querySelectorAll('.speed-2');
      console.log(2,speed_2)
        gsap.to(speed_2, { 
          yPercent: 50,
          ease: "none",
          scrollTrigger: {
            trigger: speed_2,
            scrub: true
          }
        })
  
      ScrollTrigger.refresh();
    }
  });

const speed_0 = gsap.utils.toArray('.speed-0');
speed_0.forEach(speed0 => {
  gsap.to(speed0, { 
    yPercent: -40,
    ease: "none",
    scrollTrigger: {
      trigger: speed0,
      scrub: true
    }
  })
});

const speed_1 = gsap.utils.toArray('.speed-1');
speed_1.forEach(speed1 => {
  gsap.to(speed1, { 
    yPercent: -30,
    ease: "none",
    scrollTrigger: {
      trigger: speed1,
      scrub: true
    }
  })
});

const speed_2 = gsap.utils.toArray('.speed-2');
speed_2.forEach(speed2 => {
  gsap.to(speed2, { 
    yPercent: 30,
    ease: "none",
    scrollTrigger: {
      trigger: speed2,
      scrub: true
    }
  })
});
              
            
!
999px

Console