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

              
                <!--- this is a filler panel  -->
<section class="py-40 bg-gray-600">
  <div class="wrapper" style="min-height:1500px">
        <p>Filler content area, to ensure long scroll...</p>
  </div>
</section>
<!-- end filler panel -->



<section class="bg-white py-32" id="rangePanel">
    <div class="wrapper">
        <div class="flex -mx-16">
          
          
            <div class="w-1/2 px-16 text-black">
              
                <div id="rangeBlocks" class="space-y-6">
                <!-- block --> 
                    <div class="overflow-hidden rounded-lg || rangeBlock">
                        <a href="#" class="block w-full overflow-hidden">
                            <div class="relative">
                                <div class="absolute z-10 flex items-center justify-center w-full h-full bg-black bg-opacity-25">
                                    <p class="text-3xl tracking-wider text-white uppercase font-display">Block<span class="font-serif italic tracking-wide normal-case">label</span></p>
                                </div>
                                <div class="">
                                    <img src="https://placehold.it/400x225" class="object-cover w-full h-full" alt="">
                                </div>
                            </div>
                        </a>
                    </div>
                <!-- end block -->
              
                <!-- block --> 
                    <div class="overflow-hidden rounded-lg || rangeBlock">
                        <a href="#" class="block w-full overflow-hidden">
                            <div class="relative">
                                <div class="absolute z-10 flex items-center justify-center w-full h-full bg-black bg-opacity-25">
                                    <p class="text-3xl tracking-wider text-white uppercase font-display">Block<span class="font-serif italic tracking-wide normal-case">label</span></p>
                                </div>
                                <div class="">
                                    <img src="https://placehold.it/400x225" class="object-cover w-full h-full" alt="">
                                </div>
                            </div>
                        </a>
                    </div>
                <!-- end block -->
              
                <!-- block --> 
                    <div class="overflow-hidden rounded-lg || rangeBlock">
                        <a href="#" class="block w-full overflow-hidden">
                            <div class="relative">
                                <div class="absolute z-10 flex items-center justify-center w-full h-full bg-black bg-opacity-25">
                                    <p class="text-3xl tracking-wider text-white uppercase font-display">Block<span class="font-serif italic tracking-wide normal-case">label</span></p>
                                </div>
                                <div class="">
                                    <img src="https://placehold.it/400x225" class="object-cover w-full h-full" alt="">
                                </div>
                            </div>
                        </a>
                    </div>
                <!-- end block -->
              
                <!-- block --> 
                    <div class="overflow-hidden rounded-lg || rangeBlock">
                        <a href="#" class="block w-full overflow-hidden">
                            <div class="relative">
                                <div class="absolute z-10 flex items-center justify-center w-full h-full bg-black bg-opacity-25">
                                    <p class="text-3xl tracking-wider text-white uppercase font-display">Block<span class="font-serif italic tracking-wide normal-case">label</span></p>
                                </div>
                                <div class="">
                                    <img src="https://placehold.it/400x225" class="object-cover w-full h-full" alt="">
                                </div>
                            </div>
                        </a>
                    </div>
                <!-- end block -->
                </div>
            
            </div>
          
          
            <div class="w-1/2 px-16">
                <div class="py-4 lg:py-10 overflow-hidden" id="rangeTitle">
                    <h2 class="uppercase font-display">Our Approach</h2>
                    <h3 class="pt-3 pb-6 font-serif text-2xl lg:text-4xl leading-tight tracking-wide">We can approach your project in four ways, or a combination of the following:</h3>
                    <a href="/services" class="pillBtn">Explore</a>
                </div>
            </div>
          
          
    
        </div>
    </div>
</section>




<!--- this is a filler panel  -->
<section class="py-40 bg-gray-600">
  <div class="wrapper" style="min-height:1500px">
        <p>Filler content area, to ensure long scroll...</p>
  </div>
</section>
<!-- end filler panel -->
              
            
!

CSS

              
                /* imported -- tailwind.css */

body {overflow-x: hidden}

.wrapper {
    max-width:105rem;
    padding:0 32px;
    margin:0 auto;
}
              
            
!

JS

              
                
/* 
Question:
how can i create a callback for when each .rangeBlock is aligned with #rangeTitle ? 
eg. so that I can visually highlight each .rangeBlock, as its center comes inline with #rangeTitle...
*/


let rangePanel = document.getElementById('rangePanel');
let rangeBlocks = document.getElementById('rangeBlocks');
let rangeTitle = document.getElementById('rangeTitle');

let titleOffset = rangeTitle.offsetTop - rangePanel.offsetTop;




ScrollTrigger.create({
  trigger: rangePanel,
  start: "top top", 
  end: () => "+=" + ( rangeBlocks.clientHeight - rangeTitle.clientHeight ),
  pin: rangeTitle,
});



var images = gsap.utils.toArray('.rangeBlock')

images.forEach((image, i) => {
  
  var imageTitle = image.querySelector('p');
  
  //var thisAnim = gsap.to(imageTitle, { color: 'red' }) 
  
  var thisAnim = gsap.to(image, { opacity: 0 }) 
  
  ScrollTrigger.create({
    trigger: image,
    id: "image-" + i,
    start: () => "center +" + ( (rangeTitle.clientHeight/2) + titleOffset ),
    //markers: true,
    animation: thisAnim,
    toggleActions: 'play none none reverse'
  });
  
});
              
            
!
999px

Console