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

              
                <section class="h-screen bg-black w-full flex items-center justify-center">
  <img class="w-[300px] hero-img" src="https://images.unsplash.com/photo-1687090277460-664d439eb3f1?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=687&q=80" alt="">
</section>
<section
  class="about__section relative antialiased pt-[100px] py-[50px] sm:py-[100px] sm:pt-[200px] flex justify-center items-center">
  <div class="max-w-screen-xl about-pinning px-4 mx-auto lg:px-6 ">
    <div class="flex flex-col items-center justify-between gap-8 xl:gap-20 lg:flex-row ">
      <div class="max-w-md hidden lg:block">
        <img class="w-[300px] about-trigger" src="https://images.unsplash.com/photo-1687090277460-664d439eb3f1?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=687&q=80"  />
      </div>

      <div class="text-center md:max-w-3xl lg:text-left xl:shrink-0 ">
        <div class="gsap__about-text">
          <h2 class="">asdasd</h2>
          <p class="mt-4  md:max-w-3xl md:mx-auto "> asudhakjfhjakhfjh</p>
        </div>
      </div>
    </div>
  </div>
</section>
<section class="products__section  py-[200px] h-[600px] flex justify-center items-center">
  <div class="products-container text-white flex items-center justify-center gap-20">
    <h3>Alo </h3>
    <h3>Alo </h3>
    <h3>Alo </h3>
  </div>
</section>
<section class="h-[800px] w-full bg-yellow-300"></section>
              
            
!

CSS

              
                
              
            
!

JS

              
                  const sapaBottleTL = gsap.timeline({})
  const sapaBottle = document.querySelector(".hero-img")
      function calculateStartOffset(element) {
      const elementRect = element.getBoundingClientRect()
      const elementTop = elementRect.top + window.scrollY
      const offset = 20
      return `top ${elementTop - offset}px`
    }
      // Bottle pinning
      ScrollTrigger.create({
        animation: sapaBottleTL,
        trigger: ".hero__section-container div",
        pin: sapaBottle,
        start: function () {
          return calculateStartOffset(sapaBottle)
        },
        end: "bottom+=600px 67%",
        endTrigger: ".end-gsap-1",
        invalidateOnRefresh: true,
        scrub: 1,
        // markers: true,
        pinSpacing: false,
      })

      // About Pinning
      ScrollTrigger.create({
        trigger: ".about-pinning",
        pin: true,
        start: function () {
          return calculateStartOffset(sapaBottle)
        },
        end: "+=300",
        invalidateOnRefresh: true,
        markers: true,
        pinSpacing: true,
      })

      // products pinning
      ScrollTrigger.create({
        trigger: ".products-container",
        pin: ".products__section",
        invalidateOnRefresh: true,
        start: function () {
          return calculateStartOffset(sapaBottle)
        },
        end: "+=300",
        // markers: true,
        pinSpacing: true,
      })
              
            
!
999px

Console