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

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

              
                <section class="white-section"></section>



<section class="values-section">
  <div class="container container-text">
    <div class="row">
       <div class=col-6>
         <h2>Title Section</h2>
        </div>
       <div class=col-6>
         <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nisi elit, molestie et enim ut, sollicitudin fringilla risus. Nam quis maximus tellus, sit amet cursus velit. Cras et commodo justo. Aliquam lacinia risus vitae tempor elementum. Cras placerat at justo vel laoreet. Integer ante lorem, feugiat vel ex et, faucibus porta eros.</p>
       </div>
    </div>
  </div>
  
<!-- start animation -->
  <div class="container-sliders-wrapper">
    <div class="slide-wrapper">
      <div class="title-img">
        <img src="https://images.unsplash.com/photo-1653044289916-1f8ae92a2d23?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTU0MTI5NjQ&ixlib=rb-1.2.1&q=80" alt="">
        <h2 class=value-title>Title Value</h2>
      </div>
      
      <div class="description">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nisi elit, molestie et enim ut, sollicitudin fringilla risus. </p>
      </div>
    </div>
    
    
    <div class="slide-wrapper">
      <div class="title-img">
        <img src="https://images.unsplash.com/photo-1653837357601-1e5e8ba0f61b?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTU0MTY3Mzc&ixlib=rb-1.2.1&q=80" alt="">
        <h2 class=value-title>Title Value</h2>
      </div>
      
      <div class="description">
        <p>piscing elit. Curabitur nisi elit, molestie et enim ut, sollicitudin fringilla risus. </p>
      </div>
    </div>
    
    
    
    <div class="slide-wrapper">
      <div class="title-img">
        <img src="https://images.unsplash.com/photo-1652972756751-4de8e9ef9e77?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2NTU0MTY3NjU&ixlib=rb-1.2.1&q=80" alt="">
        <h2 class=value-title>Title Value</h2>
      </div>
      
      <div class="description">
        <p>Lorem ipsum dolor sit amet,et </p>
      </div>
    </div>
    
    
  </div>
</section>



<section class="white-section"></section>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Signika+Negative:300,400&display=swap');

body { 
  font-family: "Signika Negative", sans-serif; 
  font-weight: 300;
  margin: 0;
  padding: 0 20px;
}

.white-section {
  width: 100%;
  height: 800px;
  background-color: blue ;
}

/* Style for section content */

.values-section {
  height: 100vh;
}

.container-text {
  height: 30%;
  padding-top: 100px;
}


.container-sliders-wrapper {
  height: 70%;
  overflow: hidden;
  position: relative;
}

.slide-wrapper {
  position: absolute;
top: 0;
left: 0;
width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-content: center;
  height: 100%;
}

.title-img {
  position: relative;
  
}

.value-title {
  z-index: 22;
  position: relative;
  display: block;
}
img {
  width: 100%;
  height: 100%;
  position: absolute;
}
.title-img,
.description {
  flex: 0 0 50%;
  height: 100%;
  display: flex;
  align-items: center;
}

.description {
  
}
              
            
!

JS

              
                console.clear(); // Start with a clean console on refesh
gsap.registerPlugin(ScrollTrigger);

let sections = gsap.utils.toArray(".slide-wrapper");
const length = sections.length - 1;
let container = document.querySelector(".container-sliders-wrapper");

const timeline = gsap.timeline({
  scrollTrigger: {
    trigger: ".values-section",
    pin: true,
    scrub: 1,
      snap: {
        snapTo: "labels", // snap to the closest label in the timeline
        duration: 0.5,
        delay: 0.2, // wait 0.2 seconds from the last scroll event before doing the snapping
        ease: "power1.inOut" // the ease of the snap animation ("power3" by default)
      },
    end: () => "+=" + container.offsetWidth,
    markers: true
  }
});
sections.forEach((item, index) => {
  // 🌆 Image animation in out
  if (index !== 0) { // Skip the first 
    timeline.from(item.querySelector("img"), {
      yPercent: 100,
      ease: "none"
    }, index);

  }
  timeline.add(`label-${index}`); // Add 🏷 labels to snap to
  if(index !== length) {
  timeline.to(item.querySelector("img"), {
    yPercent: -100,
    ease: "none"
  }, index + 1);
}
  // 📝 Text animation in out
    if (index !== 0) { // Skip the first
timeline.from(item.querySelector(".description"), {
    opacity: 0,
    ease: "none",
  }, index);
    }
  if(index !== length) {
    console.warn(sections.length);
timeline.to(item.querySelector(".description"), {
    opacity: 0,
    ease: "none",
  }, index + 1);
    }
});


              
            
!
999px

Console