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

              
                    <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 !important;
  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);



     ScrollTrigger.create({
       id: "parent-timeline",
       trigger: parent_container,
       start:'top top',
       toggleClass: 'started',
       pin:true,
       markers: true,
      end: () => "+=" + ((sections.length - 1) * vh(80)),
     });


     sections.forEach((sct, i) => {

       let startPosition = () => `top+=${vh(20) * (i)} top`;
       let endPosition = () => `bottom+=${vh(20) * (i+1)} top`;
       if(i === 0){
         startPosition = 'top top';
         endPosition = () => `bottom+=${vh(20)} top`;
       }

       ScrollTrigger.create({
         id: 'section',
         trigger: sct,
         start: startPosition,
         end: endPosition,
         scrub: 1,
         toggleClass: 'active',
         markers: true,
         onEnter: () => {
           var sct_index = sct.getAttribute('data-count');
           var shift_value = 48;

           var tl_container_shift_up = (shift_value * sct_index) * -1;

           timeline_container.style.marginTop = tl_container_shift_up+"px";
         },
         onLeaveBack: () => {
           var spin = sct.getAttribute('data-count');
           var current_marginTop = parseInt(timeline_container.style.marginTop);
           var new_margin_value = current_marginTop + 48;
           timeline_container.style.marginTop = new_margin_value +"px";

         },
       })

     });

     }

initTimeline();

// function init(){
//     initTimeline();
// }
// // window.addEventListener('resize', function(){
// //     init();
// // });

// window.addEventListener('load', function(){
//     init();
// });

              
            
!
999px

Console