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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

              
                
<div class="spacer">Spacer</div>  
   <div class="container container__timeline">
                <div class="timeline-nav">
                  <ul class="timeline-nav__list">
                    <li class="is-active timeline-nav__list-item">2020</li>
                    <li class="timeline-nav__list-item">2019</li>
                    <li class="timeline-nav__list-item">2017</li>
                    <li class="timeline-nav__list-item">2015</li>
                    <li class="timeline-nav__list-item">2010</li>
                  </ul>
                </div>

                <div class="timeline-slides">
                  <section id="first" class="slide">
                    <div class="slide--inner">
                      <div class="timeline-title">
                        <h3>2020</h3>
                      </div>
                      <div class="timeline-content">
                        <p>
                          Lorem ipsum dolor sit amet consectetur adipisicing
                          elit. Quod facilis tempore voluptate provident
                          pariatur, alias ducimus nulla in dolores rerum
                          accusantium, accusamus necessitatibus quia delectus
                          quam commodi ut minus sunt.
                        </p>
                        <p>
                          Lorem ipsum dolor sit amet consectetur adipisicing
                          elit. Sapiente voluptatibus itaque voluptates dolorum?
                          Aut quo dolorum delectus voluptatibus modi eaque
                          repellat odit et, excepturi ex. Accusamus sint qui eos
                          vel.
                        </p>
                        <p>
                          Lorem ipsum dolor sit amet consectetur adipisicing
                          elit. Sapiente voluptatibus itaque voluptates dolorum?
                          Aut quo dolorum delectus voluptatibus modi eaque
                          repellat odit et, excepturi ex. Accusamus sint qui eos
                          vel.
                        </p>
                      </div>
                    </div>
                  </section>

                  <section id="second" class="slide">
                    <div class="slide--inner">
                      <div class="timeline-title">
                        <h3>2019</h3>
                      </div>
                      <div class="timeline-content">
                        Lorem ipsum dolor sit amet consectetur adipisicing elit.
                        Sapiente voluptatibus itaque voluptates dolorum? Aut quo
                        dolorum delectus voluptatibus modi eaque repellat odit
                        et, excepturi ex. Accusamus sint qui eos vel.
                      </div>
                    </div>

                    <div class="slide--inner">
                      <div class="timeline-title">
                        <h3>2019</h3>
                      </div>
                      <div class="timeline-content">
                        Lorem ipsum dolor sit amet consectetur adipisicing elit.
                        Sapiente voluptatibus itaque voluptates dolorum? Aut quo
                        dolorum delectus voluptatibus modi eaque repellat odit
                        et, excepturi ex. Accusamus sint qui eos vel.
                      </div>
                    </div>
                  </section>

                  <section id="third" class="slide one">
                    <div class="slide--inner">
                      <div class="timeline-title">
                        <h3>2017</h3>
                      </div>
                      <div class="timeline-content">
                        Lorem ipsum dolor sit amet consectetur adipisicing elit.
                        Sapiente voluptatibus itaque voluptates dolorum? Aut quo
                        dolorum delectus voluptatibus modi eaque repellat odit
                        et, excepturi ex. Accusamus sint qui eos vel.
                      </div>
                    </div>
                  </section>

                  <section id="fourth" class="slide">
                    <div class="slide--inner">
                      <div class="timeline-title">
                        <h3>2015</h3>
                      </div>
                      <div class="timeline-content">
                        Lorem ipsum dolor sit amet consectetur adipisicing elit.
                        Sapiente voluptatibus itaque voluptates dolorum? Aut quo
                        dolorum delectus voluptatibus modi eaque repellat odit
                        et, excepturi ex. Accusamus sint qui eos vel.
                      </div>
                    </div>
                    <div class="slide--inner">
                      <div class="timeline-title">
                        <h3>2015</h3>
                      </div>
                      <div class="timeline-content">
                        Lorem ipsum dolor sit amet consectetur adipisicing elit.
                        Sapiente voluptatibus itaque voluptates dolorum? Aut quo
                        dolorum delectus voluptatibus modi eaque repellat odit
                        et, excepturi ex. Accusamus sint qui eos vel.
                      </div>
                    </div>
                  </section>

                  <section id="fifth" class="slide">
                    <div class="slide--inner">
                      <div class="timeline-title">
                        <h3>2010</h3>
                      </div>
                      <div class="timeline-content">
                        Lorem ipsum dolor sit amet consectetur adipisicing elit.
                        Sapiente voluptatibus itaque voluptates dolorum? Aut quo
                        dolorum delectus voluptatibus modi eaque repellat odit
                        et, excepturi ex. Accusamus sint qui eos vel.
                      </div>
                    </div>
                  </section>
                </div>
              </div>



              
            
!

CSS

              
                .spacer{
  height: 50vh;
   background: black;
  color: white;
  overflow: hidden;
}


.timeline,
.timeline__main--inner {
  display: flex;
}

.container__timeline {
  overflow: hidden;
}

.slide--inner {
  display: flex;

  width: 100%;
  max-width: 785px;
  margin: 0 auto;
}

.timeline-title {
  display: flex;
  align-items: center;

  min-height: 145px;
  padding-right: 65px;

  border-right: 1px solid grey;

  h3 {
    color: green;

    font-size: 60px;
  }
}

.timeline-content {
  position: relative;

  width: 100%;
  padding: 15px 54px 15px 62px;
}

.slide {
  height: 100vh;
}

.slide--inner {
  width: 100%;
}

.timeline-slides {
  position: relative;
}

//timeline nav
.timeline-nav {
  position: absolute;
  right: 100px;
  top: 300px;
}

.timeline-nav__list {
  position: relative;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  width: 100%;
  max-width: 50px;
  height: 400px;

  &:after {
    position: absolute;
    top: 0;
    right: 0;

    width: 5px;
    height: 100%;

    content: '';

    border-radius: 5px;
    background-color: grey;
  }
}

.timeline-nav__list-item {
  margin-right: 15px;
  padding-bottom: 20px;

  list-style: none;

  cursor: pointer;

  &.is-active {
    position: relative;

    color: green;

    &::after {
      position: absolute;
      z-index: 1;
      top: 0;
      right: -15px;

      width: 5px;
      height: 100%;

      content: '';

      border-radius: 5px;
      background-color: green;
    }
  }
}
              
            
!

JS

              
                
const sections = gsap.utils.toArray('.slide');

sections.forEach(section => {
  let tl = gsap.timeline({
    scrollTrigger: {
      trigger: section,
      start: "top top",
      end: "+=800",
      pin: true,
      scrub: true
    }
  });
  // now populate it with your animations for each sub-part:
  tl.to(section.querySelectorAll(".timeline-content"), {
    yPercent: -100,
    ease: "none"
  });
});

              
            
!
999px

Console