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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                    <main id="main">

        <header>
            <h1><span>Banner</span></h1>
        </header>


        <div id="section-timeline" class="section-timeline">
          <div class="timeline-container">
            		<article class="year year-1" data-count="1">
            		<hgroup>
            		<h2>1935</h2>
            		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text.</p>
            		</hgroup>
            	</article>
            		<article class="year year-2" data-count="2">
            		<hgroup>
            		<h2>1949</h2>
            		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text.</p>
            		</hgroup>
            	</article>
            		<article class="year year-3" data-count="3">
            		<hgroup>
            		<h2>1950</h2>
            		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text</p>
            		</hgroup>
            	</article>
            		<article class="year year-4" data-count="4">
            		<hgroup>
            		<h2>1965</h2>
            		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text</p>
            		</hgroup>
            	</article>
            		<article class="year year-5" data-count="5">
            		<hgroup>
            		<h2>1983</h2>
            		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text</p>
            		</hgroup>
            	</article>
            		<article class="year year-6" data-count="6">
            		<hgroup>
            		<h2>1989</h2>
            		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text.</p>
            		</hgroup>
            	</article>
            		<article class="year year-7" data-count="7">
            		<hgroup>
            		<h2>1999</h2>
            		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text</p>
            		</hgroup>
            	</article>
            		<article class="year year-8" data-count="8">
            		<hgroup>
            		<h2>2001</h2>
            		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text</p>
            		</hgroup>
            	</article>
            		<article class="year year-9" data-count="9">
            		<hgroup>
            		<h2>2002</h2>
            		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text</p>
            		</hgroup>
            	</article>
            		<article class="year year-10" data-count="10">
            		<hgroup>
            		<h2>2003</h2>
            		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy texts.</p>
            		</hgroup>
            	</article>


              <article class="year year-11" data-count="11">
              <hgroup>
              <h2>2004</h2>
              <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text.</p>
              </hgroup>
            </article>
            <article class="year year-12" data-count="12">
            <hgroup>
            <h2>2005</h2>
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text.</p>
            </hgroup>
          </article>
          <article class="year year-13" data-count="13">
          <hgroup>
          <h2>2006</h2>
          <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text.</p>
          </hgroup>
        </article>
        <article class="year year-14" data-count="14">
        <hgroup>
        <h2>2007</h2>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text.</p>
        </hgroup>
      </article>
      <article class="year year-15" data-count="15">
      <hgroup>
      <h2>2008</h2>
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text.</p>
      </hgroup>
    </article>
          </div>
        </div>


    </main> <!-- #main-container -->
    <div class="footer">
    <h1>footer</h1>
    </div>
              
            
!

CSS

              
                :root {
  --text-color: white;
  --text-dark-color: #202020;
  --header-height: 100px;
  --burger-width: 40px;
  --font-headings: Georgia, serif;
  --blue: #758A94;
  --bluedark: #566C76;
  --v-spacing: 10vh;
  --h-gutter: 6.6vw;
  --easing: cubic-bezier(0.5, 0.7, 0.4, 1);
}

body {
  font: 16px/1.7 'Source Sans Pro', Helvetica, Helvetica Neue, Arial, sans-serif;
  color: var(--text-dark-color);
  background-color: var(--blue);
}

header {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  flex-direction: column;
  z-index: 2;
}

header h1 {
  font-family: var(--font-headings);
  font-weight: normal;
  color: #fff;
  font-size: 7vw;
  line-height: 7.4vw;
  z-index: 1;
  margin-bottom: 0;
  pointer-events: none;
}

/* =Main */
main {
  z-index: 1;
  position: relative;

}
.footer{
  height: 700px;
  position: relative;
  z-index: 9999;
  background: red;
}

.footer h1{
  margin: 0;
}
/*section {
  position: relative;
}*/
.section-timeline {
  position: relative;
  top: 0;
  left: 0;
  width: 100vw;
  overflow: hidden;
  height: 100vh;
  background: #232323;

}
.test{
  padding-top: 200px;
}
.timeline-container {
  height: 100vh;
  width: 100%;
  position: absolute;
/*   transition: 0.6s cubic-bezier(0.28, 0, 0.18, 1); */
  padding-top: 100px;

  padding-bottom: 100px;

}
.timeline-container article {
  position: relative;
    z-index: 1000;
    color: white;
    text-align: center;

    display: flex;
flex-direction: row ;
flex-wrap: nowrap ;
justify-content: center;
align-items: center;
align-content: center;

}
.timeline-container  article.year hgroup{
/*  position: absolute;
    top: 50%;
    width: 90%;
    left: 50%;
        transform: translateY(-50%) translateX(-50%);*/
}
.timeline-container article.year {
/*   transition: 0.6s cubic-bezier(0.28, 0, 0.18, 1) 0.3s; */
  height: 100vh;
  max-height: 3rem;
  position: relative;
  color: white;
  text-align: center;
}

.timeline-container article.year hgroup h2 {
/*   transition: 0.6s cubic-bezier(0.28, 0, 0.18, 1); */
  font-size: 2rem;
  line-height: 1;
  margin: 0;
}

.timeline-container article.year hgroup p {
  line-height: 1.5;
  font-size: 1.25rem;
  opacity: 0;
  max-height: 0px;
  max-width: 600px;
  margin: 0 auto;
/*   transition: opacity 0.6s cubic-bezier(0.28, 0, 0.18, 1); */
}

/*ACTIVE*/
#section-timeline article.year.active {
  max-height: 80vh;
}
/*#section-timeline article.year:after{
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  width: 4px;
  background: #ffffff;
  height: 120px;
  margin-top: -60px;
  max-height: 0px;
      transform: translateX(-50%) translateY(-100%);
      transition: 0.3s cubic-bezier(0.28, 0, 0.18, 1);

}*/
#section-timeline article.year hgroup:after{
  content: '';
  position: absolute;
  /*top: 100%;*/
  top: 90%;
  left: 50%;
  width: 4px;
  background: #ffffff;
  height: 120px;

  max-height: 0px;
      transform: translateX(-50%) translateY(-100%);
/*       transition: 0.3s cubic-bezier(0.28, 0, 0.18, 1);
 */
}
#section-timeline article.year.active hgroup:after{
/*   transition: 0.6s cubic-bezier(0.28, 0, 0.18, 1) 0.6s; */
  max-height: 90px;
}
/*#section-timeline article.year.active:after{
  transition: 0.6s cubic-bezier(0.28, 0, 0.18, 1) 0.6s;
  max-height: 90px;
}*/
#section-timeline.started .year.active h2 {
/*   transition: 0.6s cubic-bezier(0.28, 0, 0.18, 1) 0.6s; */
}
#section-timeline.started .year.active p{
/*   transition: opacity 0.6s cubic-bezier(0.28, 0, 0.18, 1) 1s; */
}

.timeline-container article.year.active hgroup h2 {
  font-size: 10rem;
}

.timeline-container  article.year.active hgroup p {
  opacity: 1 !important;
  max-height: 100%;
}

              
            
!

JS

              
                gsap.registerPlugin(ScrollTrigger);

function initTimeline(){

  let parent_container = document.getElementById("section-timeline");
  let timeline_container = parent_container.querySelector(".timeline-container");
  var sections = timeline_container.querySelectorAll(".year");

  const vh = (coef) => window.innerHeight * (coef/100);

  let parentST = ScrollTrigger.create({
    id: "parent-timeline",
    trigger: parent_container,
    start:'top top',
    toggleClass: 'started',
    pin:true,
    markers: true,
    end: () => "+=" + ((sections.length - 1) * vh(80)),
  });
  
  let currentSection;
  
  function goto(section, i) {
    if (currentSection !== section) { // if the section is the currentSection, skip
       // move the container
      gsap.to(timeline_container, {
        y: -48 * i,
        duration: 0.6,
        overwrite: true
      });
      let tl = gsap.timeline({defaults:{overwrite: true}});
      // animate OUT the current section (if there is one)
      if (currentSection) {
        tl.to(currentSection.querySelector("h2"), {
          fontSize: "2rem",
        });
        tl.to(currentSection, {
          maxHeight: "3rem"
        }, 0);
        tl.to(currentSection.querySelectorAll("p"), {
          opacity: 0,
          duration: 0.25,
          maxHeight: "0%"
        }, 0);
      }
      currentSection = section;
      // animate IN the new section (if there is one)
      if (section) {
        tl.to(section.querySelector("h2"), {
          fontSize: "10rem",
        }, 0);
        tl.to(section, {
          maxHeight: "80vh"
        }, 0);
        tl.fromTo(section.querySelectorAll("p"), {maxHeight:"0%"}, {
          opacity: 1,
          maxHeight: "100%"
        });
      }
    }
  }


  sections.forEach((sct, i) => {
    let sct_index = sct.getAttribute('data-count');
  
    ScrollTrigger.create({
      start: () => parentST.start + i * window.innerHeight * 0.4,
      end: () => "+=" + window.innerHeight * 0.4,
      markers: true,
      onLeaveBack: () => i || goto(null, 0),
      onToggle: self => self.isActive && goto(sct, sct_index)
    });
  });

}

initTimeline();

              
            
!
999px

Console