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 id="page-container">
      <!-- ----------CONTAINER #1 ---------- -->
      <div class="container-div" id="main-container">
        <div class="text-div" id="text-div-1">
          <h2 class="timeline-side-text scrollable" id="side-text-1">
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
          </h2>
        </div>
        <div class="image-div" id="image-div">
          <div class="date-text-div" id="date-text-div">
            <h2 class="fixed-date-text date-text" id="fixed-text">20</h2>
            <div
              class="hidden-element dinamic-date-text date-text scrollable"
              id="dinamic-text"
            >
              10
            </div>
          </div>
          <img class="image1" src='https://source.unsplash.com/random/500x1000?sig=1' alt=''>
           <img class="image2"  src='https://source.unsplash.com/random/500x1000?sig=2' alt=''>
           <img class="image3"  src='https://source.unsplash.com/random/500x1000?sig=3' alt=''>
           <img class="image4"  src='https://source.unsplash.com/random/500x1000?sig=4' alt=''>
          
        </div>
      </div>

      <!-- ----------CONTAINER #2---------- -->
      <div class="container-div" id="main-container-2">
        <div class="text-div" id="text-div-2">
          <h2 class="timeline-side-text scrollable" id="side-text-2">
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
          </h2>
        </div>
        <div class="image-div" id="image-div-2">
          <div class="date-text-div" id="date-text-div">
            <h2 class="fixed-date-text date-text hidden-element" id="fixed-text-2">20</h2>
            <div
              class="dinamic-date-text date-text scrollable"
              id="dinamic-text-2"
            >
              10
            </div>
          </div>
        </div>
      </div>
      <!-- ----------CONTAINER #3---------- -->
      <div class="container-div" id="main-container-3">
        <div class="text-div" id="text-div-3">
          <h2 class="timeline-side-text scrollable" id="side-text-3">
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
          </h2>
        </div>
        <div class="image-div" id="image-div-3">
          <div class="date-text-div" id="date-text-div">
            <h2 class="fixed-date-text date-text hidden-element" id="fixed-text-3">20</h2>
            <div class="dinamic-date-text date-text scrollable" id="dinamic-text-3">12</div>
          </div>
        </div>
      </div>
      <!-- ----------CONTAINER #4---------- -->
      <div class="container-div" id="main-container-4">
        <div class="text-div" id="text-div-4">
          <h2 class="timeline-side-text scrollable" id="side-text-4">
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
          </h2>
        </div>
        <div class="image-div" id="image-div-4">
          <div class="date-text-div" id="date-text-div">
            <h2 class="fixed-date-text date-text hidden-element" id="fixed-text-4">20</h2>
            <div class="dinamic-date-text date-text scrollable" id="dinamic-text-4">13</div>
          </div>
        </div>
      </div>
      <!-- ----------CONTAINER #5---------- -->
      <div class="container-div" id="main-container-5">
        <div class="text-div" id="text-div-5">
          <h2 class="timeline-side-text scrollable" id="side-text-5">
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
          </h2>
        </div>
        <div class="image-div" id="image-div-5">
          <div class="date-text-div" id="date-text-div">
            <h2 class="fixed-date-text date-text hidden-element" id="fixed-text-5">20</h2>
            <div class="dinamic-date-text date-text scrollable" id="dinamic-text-5">15</div>
          </div>
        </div>
      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/gsap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/ScrollTrigger.min.js"></script>
    <script src="index.js"></script>

              
            
!

CSS

              
                body,
html {
  margin: 0;
  padding: 0;
  color: #fff;
}

.section{
  height: 100vh;
}

.container-div{
  display: flex;
  align-items: center;
}

.text-div{
  width: 50%;
}

.date-text-div{
  height: 100%;
  text-align: center;
  display: table-cell;
  vertical-align: middle;
}

.date-text{
  font-family: Raleway;
  font-weight: 800;
  display: inline-block;
  font-size: 10rem;
}

.fixed-date-text{
  z-index: 999;
}


.timeline-side-text{
  color:#3AC4D2;
  font-family: Raleway;
  font-weight: 500;
  padding-left: 10vw;
  font-size: 2rem;
  width: 30vw;
}

.hidden-element{
  visibility: hidden;
}

#image-div {
  z-index: -1;
}

#image-div img {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  object-fit: cover;
  z-index: -1;
}

.image-div {
  position: relative;
  display: table;
  width: 50%;
  height: 100vh;
  align-items: center;
}
              
            
!

JS

              
                gsap.registerPlugin(ScrollTrigger);

ScrollTrigger.create({
  trigger: "#page-container",
  pin: "#image-div",
  markers: true
});

gsap.set('.image-div img + img', {
  yPercent: 100,
})

let firstTransition = gsap.timeline({scrollTrigger: {
    trigger: "#main-container-2",
    id: "container2",
    start: 'top top',
    markers: true,
    toggleActions: "play none reverse none",
  }})

firstTransition.to(".image1", {
  yPercent: -100,
})
firstTransition.to(".image2", {
  yPercent: 0,
}, 0);

let secondTransition = gsap.timeline({scrollTrigger: {
    trigger: "#main-container-3",
    id: "container3",
    start: 'top top',
    markers: true,
    toggleActions: "play none reverse none",
  }})

secondTransition.to(".image2", {
  yPercent: -100,
})
secondTransition.to(".image3", {
  yPercent: 0,
}, 0);

let thirdTransition = gsap.timeline({scrollTrigger: {
    trigger: "#main-container-4",
    id: "container4",
    start: 'top top',
    markers: true,
    toggleActions: "play none reverse none",
  }})

thirdTransition.to(".image3", {
  yPercent: -100,
})
thirdTransition.to(".image4", {
  yPercent: 0,
}, 0);

              
            
!
999px

Console