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

              
                <header>
  <nav class="navbar navbar-expand-md  fixed-top navbar-light bg-light">
    <div class="container-fluid">
      <a class="navbar-brand" href="#">
        <img src="https://getbootstrap.com/docs/5.1/assets/brand/bootstrap-logo.svg" alt="" width="30" height="24" class="d-inline-block align-text-top">
        Test website
      </a>
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbarNav">
        <ul class="navbar-nav">
          <li class="nav-item">
            <a class="nav-link active" aria-current="page" href="#">Home</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">One</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">Two</a>
          </li>
          <li class="nav-item">
            <a class="nav-link disabled">Three</a>
          </li>
        </ul>
      </div>
    </div>
  </nav>
</header>
<main id="main-wrap">
  <div class="intro gsap-section blue-bg">
    <div class="container-fluid container-md">
      <div class="row">
        <div class="col-12 col-md-6 offset-md-3 text-center">
          <h1> This is our history page </h1>
    <p class="lead">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam a nisl porta, ullamcorper lectus eu, pellentesque sem.</p>
    
          <div class="scroll-info">
            <span class="mouse-icon"></span>
            <span class="text">Start scrolling to be inspired</span>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div id="gsap-wrap" class="">
    <div id="slides-container">
      <section id="section-1" class="gsap-section blue-bg dark" data-custom-toggle="gsap-me-hard" data-custom-options='{"id":"#section-1","title":"1992","subtitle":"Start","dark":true}'>
        <div class="container-fluid container-md">
          <div class="row align-items-center">
            <div class="col-12 col-md-6 offset-md-3 text-center">
              <h3>Start of our path</h3>
              <div class="scrollable">
                <p>Sed aliquet mi ac quam blandit luctus. Donec accumsan lobortis ante ut porttitor. Nam quam tortor, semper ornare felis ut, accumsan fermentum quam. Pellentesque turpis nunc, scelerisque vel libero a, fermentum eleifend lacus. Donec nec nisi convallis ipsum auctor pharetra. Phasellus lacinia maximus sollicitudin. Nulla nec lorem et diam fringilla tempor sit amet sed orci. Proin blandit eget dui vitae tempus. Sed scelerisque id nibh et euismod. Nunc in posuere ligula.</p>

               <p> Vivamus lobortis tristique urna. Nulla facilisi. Mauris ac felis id dolor laoreet sagittis sit amet id dolor. Curabitur molestie augue urna, sit amet imperdiet nisi interdum eget. Phasellus eget augue sodales, gravida neque sit amet, posuere nibh. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nullam eu magna eu enim sodales porttitor. Donec vestibulum porttitor mollis. Curabitur porttitor non sem eget dapibus. Phasellus at ullamcorper ex. Pellentesque mauris tellus, gravida sodales tincidunt id, bibendum sit amet neque. Vestibulum faucibus arcu eget quam vulputate aliquam.</p>

                <p>Suspendisse sit amet dignissim lacus, lobortis cursus urna. Aenean eleifend, neque convallis blandit gravida, dui eros finibus ipsum, quis elementum magna purus sed ex. Quisque rhoncus risus in eros facilisis accumsan. Nulla facilisis, nunc nec interdum luctus, ante ligula dictum magna, et gravida magna ligula vulputate sem. Mauris euismod sapien pretium tempor hendrerit. Sed mattis turpis maximus ipsum dapibus cursus. Donec sed condimentum sem, pellentesque euismod dolor. Vestibulum auctor sapien eget felis pretium rhoncus. In hac habitasse platea dictumst. Vivamus congue consectetur tincidunt. Nulla ac sapien tellus. Sed ullamcorper luctus massa, vitae egestas ligula euismod vitae.</p>

                <p>Suspendisse mattis maximus maximus. Mauris aliquet massa vitae dictum pretium. Pellentesque non maximus elit. Ut quis consequat felis, sit amet convallis elit. Aliquam erat volutpat. Nam ac velit id nunc sodales dignissim et nec quam. Morbi egestas ultrices mi sit amet tristique. Aenean ac augue ac ex luctus venenatis.</p>
              </div>
            </div>
          </div>
        </div>
      </section>
      <section id="section-2" class="gsap-section" data-custom-toggle="gsap-me-hard" data-custom-options='{"id":"#section-2","title":"1998","subtitle":"Developing","dark":false}'>
        <div class="container-fluid container-md">
          <div class="row align-items-center">
            <div class="col-12 col-md-4 offset-md-1">
              <img src="https://getbootstrap.com/docs/5.1/assets/brand/bootstrap-logo.svg" alt="" class="img-fluid" class="d-inline-block align-text-top">
            </div>
            <div class="col-12 col-md-5">
              <h3>Developing our strength</h3>
              <div class="scrollable">
                <p>Sed aliquet mi ac quam blandit luctus. Donec accumsan lobortis ante ut porttitor. Nam quam tortor, semper ornare felis ut, accumsan fermentum quam. Pellentesque turpis nunc, scelerisque vel libero a, fermentum eleifend lacus. Donec nec nisi convallis ipsum auctor pharetra. Phasellus lacinia maximus sollicitudin. Nulla nec lorem et diam fringilla tempor sit amet sed orci. Proin blandit eget dui vitae tempus. Sed scelerisque id nibh et euismod. Nunc in posuere ligula.</p>
              </div>
            </div>
          </div>
        </div>
      </section>
      <section id="section-3" class="gsap-section red-bg dark" data-custom-toggle="gsap-me-hard" data-custom-options='{"id":"#section-3","title":"2004","subtitle":"Improoving","dark":true}'>
        <div class="container-fluid container-md">
          <div class="row align-items-center">
            <div class="col-12 order-2 col-md-5 offset-md-1 order-md-1">
              <h3>Improoving some inner chakras</h3>
              <div class="scrollable">
                <p>Sed aliquet mi ac quam blandit luctus. Donec accumsan lobortis ante ut porttitor. Nam quam tortor, semper ornare felis ut, accumsan fermentum quam. Pellentesque turpis nunc, scelerisque vel libero a, fermentum eleifend lacus. Donec nec nisi convallis ipsum auctor pharetra. Phasellus lacinia maximus sollicitudin. Nulla nec lorem et diam fringilla tempor sit amet sed orci. Proin blandit eget dui vitae tempus. Sed scelerisque id nibh et euismod. Nunc in posuere ligula.</p>
              </div>
            </div>
            <div class="col-12 order-1 col-md-4 order-md-2">
              <img src="https://images.unsplash.com/photo-1552247064-3c20191acba6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1925&q=80" class="img-fluid" />
            </div>
          </div>
        </div>
      </section>
      <section id="section-4" class="gsap-section blue-bg dark" data-custom-toggle="gsap-me-hard" data-custom-options='{"id":"#section-4","title":"2010","subtitle":"Breakthrough","dark":true}'>
        <div class="container-fluid container-md">
          <div class="row align-items-center">
            <div class="col-12 col-md-4 offset-md-1">
              <img src="https://images.unsplash.com/photo-1533709752211-118fcaf03312?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=3270&q=80" alt="" class="img-fluid" class="d-inline-block align-text-top">
            </div>
            <div class="col-12 col-md-5">
              <h3>Breakthrough into new technologies</h3>
              <div class="scrollable">
                <p>Sed aliquet mi ac quam blandit luctus. Donec accumsan lobortis ante ut porttitor. Nam quam tortor, semper ornare felis ut, accumsan fermentum quam. Pellentesque turpis nunc, scelerisque vel libero a, fermentum eleifend lacus. Donec nec nisi convallis ipsum auctor pharetra. Phasellus lacinia maximus sollicitudin. Nulla nec lorem et diam fringilla tempor sit amet sed orci. Proin blandit eget dui vitae tempus. Sed scelerisque id nibh et euismod. Nunc in posuere ligula.</p>

               <p> Vivamus lobortis tristique urna. Nulla facilisi. Mauris ac felis id dolor laoreet sagittis sit amet id dolor. Curabitur molestie augue urna, sit amet imperdiet nisi interdum eget. Phasellus eget augue sodales, gravida neque sit amet, posuere nibh. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nullam eu magna eu enim sodales porttitor. Donec vestibulum porttitor mollis. Curabitur porttitor non sem eget dapibus. Phasellus at ullamcorper ex. Pellentesque mauris tellus, gravida sodales tincidunt id, bibendum sit amet neque. Vestibulum faucibus arcu eget quam vulputate aliquam.</p>

                <p>Suspendisse sit amet dignissim lacus, lobortis cursus urna. Aenean eleifend, neque convallis blandit gravida, dui eros finibus ipsum, quis elementum magna purus sed ex. Quisque rhoncus risus in eros facilisis accumsan. Nulla facilisis, nunc nec interdum luctus, ante ligula dictum magna, et gravida magna ligula vulputate sem. Mauris euismod sapien pretium tempor hendrerit. Sed mattis turpis maximus ipsum dapibus cursus. Donec sed condimentum sem, pellentesque euismod dolor. Vestibulum auctor sapien eget felis pretium rhoncus. In hac habitasse platea dictumst. Vivamus congue consectetur tincidunt. Nulla ac sapien tellus. Sed ullamcorper luctus massa, vitae egestas ligula euismod vitae.</p>

                <p>Suspendisse mattis maximus maximus. Mauris aliquet massa vitae dictum pretium. Pellentesque non maximus elit. Ut quis consequat felis, sit amet convallis elit. Aliquam erat volutpat. Nam ac velit id nunc sodales dignissim et nec quam. Morbi egestas ultrices mi sit amet tristique. Aenean ac augue ac ex luctus venenatis.</p>
              </div>
            </div>
          </div>
        </div>
      </section>
      <section id="section-5" class="gsap-section" data-custom-toggle="gsap-me-hard" data-custom-options='{"id":"#section-5","title":"2020","subtitle":"New era","dark":false}'>
        <div class="container-fluid container-md">
          <div class="row align-items-center">
            <div class="col-12 order-2 col-md-5 offset-md-1 order-md-1">
              <h3>Gulping for new air into new ERA</h3>
              <div class="scrollable">
                <p>Sed aliquet mi ac quam blandit luctus. Donec accumsan lobortis ante ut porttitor. Nam quam tortor, semper ornare felis ut, accumsan fermentum quam. Pellentesque turpis nunc, scelerisque vel libero a, fermentum eleifend lacus. Donec nec nisi convallis ipsum auctor pharetra. Phasellus lacinia maximus sollicitudin. Nulla nec lorem et diam fringilla tempor sit amet sed orci. Proin blandit eget dui vitae tempus. Sed scelerisque id nibh et euismod. Nunc in posuere ligula.</p>

               <p> Vivamus lobortis tristique urna. Nulla facilisi. Mauris ac felis id dolor laoreet sagittis sit amet id dolor. Curabitur molestie augue urna, sit amet imperdiet nisi interdum eget. Phasellus eget augue sodales, gravida neque sit amet, posuere nibh. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nullam eu magna eu enim sodales porttitor. Donec vestibulum porttitor mollis. Curabitur porttitor non sem eget dapibus. Phasellus at ullamcorper ex. Pellentesque mauris tellus, gravida sodales tincidunt id, bibendum sit amet neque. Vestibulum faucibus arcu eget quam vulputate aliquam.</p>

                <p>Suspendisse sit amet dignissim lacus, lobortis cursus urna. Aenean eleifend, neque convallis blandit gravida, dui eros finibus ipsum, quis elementum magna purus sed ex. Quisque rhoncus risus in eros facilisis accumsan. Nulla facilisis, nunc nec interdum luctus, ante ligula dictum magna, et gravida magna ligula vulputate sem. Mauris euismod sapien pretium tempor hendrerit. Sed mattis turpis maximus ipsum dapibus cursus. Donec sed condimentum sem, pellentesque euismod dolor. Vestibulum auctor sapien eget felis pretium rhoncus. In hac habitasse platea dictumst. Vivamus congue consectetur tincidunt. Nulla ac sapien tellus. Sed ullamcorper luctus massa, vitae egestas ligula euismod vitae.</p>

                <p>Suspendisse mattis maximus maximus. Mauris aliquet massa vitae dictum pretium. Pellentesque non maximus elit. Ut quis consequat felis, sit amet convallis elit. Aliquam erat volutpat. Nam ac velit id nunc sodales dignissim et nec quam. Morbi egestas ultrices mi sit amet tristique. Aenean ac augue ac ex luctus venenatis.</p>
              </div>
            </div>
            <div class="col-12 order-1 col-md-4 order-md-2">
              <img src="https://images.unsplash.com/photo-1555465083-a845797ef750?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1064&q=80" alt="" class="img-fluid" class="d-inline-block align-text-top">
            </div>
          </div>
        </div>
      </section>
    </div>
  </div>
</main>
<footer>
  <div class="container-fluid container-md">
    <div class="row">
      <div class="col-md-3">
        <img src="https://getbootstrap.com/docs/5.1/assets/brand/bootstrap-logo.svg" alt="" width="100" height="80" class="d-inline-block align-text-top">
      </div>
      <div class="col-md-3">
        <ul class="nav flex-column">
          <li class="nav-item">
            <a href="#" class="nav-link" data-drupal-link-system-path="<front>">One</a>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link" data-drupal-link-system-path="<front>">Two</a>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link" data-drupal-link-system-path="<front>">Three</a>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link" data-drupal-link-system-path="<front>">Four</a>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link" data-drupal-link-system-path="<front>">Five</a>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link" data-drupal-link-system-path="<front>">Six</a>
          </li>
        </ul>
      </div>
      <div class="col-md-3">
        <ul class="nav flex-column">
          <li class="nav-item">
            <a href="#" class="nav-link" data-drupal-link-system-path="<front>">Seven</a>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link" data-drupal-link-system-path="<front>">Eight</a>
          </li>
          <li class="nav-item">
            <a href="#" class="nav-link" data-drupal-link-system-path="<front>">Nine</a>
          </li>
        </ul>
      </div>
      <div class="col-md-3">
        Follow us <br/>
        <strong>FB | YT</strong>
      </div>
    </div>
    <div class="row">
      <div class="col-12 my-2">
        <p class="copyright">Copyright 2022 some dumb text below</p>
      </div>
    </div>
  </div>
</footer>

              
            
!

CSS

              
                :root {
  --primary-1-blue-900-p: #01426a;
  --primary-2-red-900-cta-hover: #7f2b42;
  --primary-2-red-800-p: #b83a4b;
  --neutral-white: #fff;
  --neutral-gray-3: #8c8d8e;
  --secondary-1-medium-grey-400: #d0d4d6;
  --font-montserrat: Montserrat, Helvetica, Arial, sals-serif;
  --font-mont: Arial Black, Arial, sans-serif;
}

.intro {
  height: calc( 100vh - 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--secondary-1-medium-grey-400);
  background-image: linear-gradient(to bottom, var(--primary-1-blue-900-p), var(--primary-1-blue-900-p));
  
  .container {
    z-index: 1;
  }
  
  .scroll-info {
    font: {
      family: var(--font-montserrat);
      size: 12px;
      weight: 500;
      stretch: normal;
      style: normal;
    }
    line-height: 1.33;
    letter-spacing: 0.4px;
    text-align: center;
    color: white; //var(--secondary-1-medium-grey-400);
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    cursor: pointer;
    
    .text {
      color: white;
    }

    .mouse-icon {
      display: block;
      width: 18px; height: 30px;
      border-radius: 9px;
      border: solid 1px var(--neutral-white);
      position: absolute;
      bottom: calc( 100% + 1rem);
      left: 50%;
      transform: translateX(-50%);


      &:before {
        content: '';
        display: block;
        width: 4px;
        height: 16px;
        opacity: 0.8;
        border-radius: 2px;
        background-image: linear-gradient(to bottom, rgba(184, 58, 75, 0) 1%, var(--primary-2-red-800-p));
        position: absolute;
        bottom: 5px;
        left: 50%;
        transform: translateX(-50%);
      }

      &:after {
        content: '';
        display: block;
        width: 4px;
        height: 4px;
        background-color: var(--primary-2-red-800-p);
        border-radius: 2px;
        position: absolute;
        bottom: 5px;
        left: 50%;
        transform: translateX(-50%);
      }
    }
  }
}


#gsap-wrap {
  
  .gsap-section {
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;


    &.dark {
      color: white;
    }

    &.blue-bg {
      background-image: linear-gradient(to bottom, var(--primary-1-blue-900-p), var(--primary-1-blue-900-p));
    }

    &.red-bg {
      background-image: linear-gradient(to bottom, var(--primary-2-red-800-p), var(--primary-2-red-800-p));
    }


    .scrollable {
      max-height: 40vh;
      overflow-y: auto;
      padding-right: 1rem;
    }
  }
  
  .navigator {
    position: fixed;
    z-index: 10;
    top:   5rem;
    right: 5rem;
    height: calc(100vh - 6rem);
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    transition: all .2s ease-in-out;
    opacity: 0;

    .spy-item {
      position: relative;
      padding-right: 2rem;
      text-decoration: none;
      height: 65px;
      display: flex;
      flex-direction: column;
      justify-content: center;

      .bar {
        display: block;
        width: 1px;
        background: grey;
        position: absolute;
        top: 50%;
        right: -1px;
      }

      span {
        display: block;
        font: {
          family: var(--font-mont);
          size: 1rem;
          weight: normal;
          stretch: normal;
          style: normal;
        }
        line-height: 1.76;
        letter-spacing: normal;
        text-align: right;
        color: var(--neutral-gray-3);
        text-transform: uppercase;
        transition: all .2s ease-in-out;
      }

      small {
        display: block;
        font: {
          family: var(--font-montserrat);
          size: 0;
          weight: bold;
          stretch: normal;
          style: normal;
        }
        line-height: 1.33;
        letter-spacing: 0.4px;
        text-align: right;
        color: var(--neutral-gray-3);
        text-transform: uppercase;
        opacity: 0;
        transition: all .2s ease-in-out;
      }

      &:after {
        content: '';
        display: block;
        position: absolute;
        z-index: 1;
        top: 50%;
        right: -4.5px;
        margin-top: -4.5px;


        width:  9px;
        height: 9px;
        border-radius: 50%;
        transform-origin: center center !important;
        border: 1px dotted var(--neutral-gray-3);
        background: {
          color: var(--neutral-gray-3);
          repeat: no-repeat;
        }
      }

      &.active {
        //.bar {
        //  top: calc(50% + 1rem);
        //}

        span {
          font: {
            size: 2.5rem;
            weight: bold;
          }
          line-height: 1.2;
          letter-spacing: 0.58px;
          color: var(--primary-2-red-800-p);
        }

        small {
          font-size: 12px;
          opacity: 1;
          color: var(--primary-2-red-800-p);
        }

        &:after {
          width:  27px;
          height: 27px;
          margin-top: -13.5;
          right: -13.5px;
          border: 2px dotted var(--primary-2-red-800-p);
          background: {
            color: transparent;
            image: radial-gradient(var(--primary-2-red-800-p) 50%, transparent 50%);
          };
        }
      }

      &:last-child {
        .bar { display: none; }
      }

      &:not(.active):hover {
        span {
          font-weight: bold;
        }
      }
    }

    &.dark {
      .spy-item.active {
        span, small {
          color: var(--neutral-white);
        }

        &:after {
          border: 2px dotted var(--neutral-white);
          background-image: radial-gradient(var(--neutral-white) 50%, transparent 50%);;
        }
      }
    }

    &.revealed {
      opacity: 1;
    }
  }
}

footer {
  padding: 2rem 0 0;
  background: var(--primary-1-blue-900-p);
  color: white;
  
  a.nav-link {
    color: white;
    
    &:hover {
      color: var(--primary-2-red-800-p);
    }
  }
  
  .copyright {
    text-align: center;
    margin-bottom: 0;
    font-size: .8rem;
  }
}
              
            
!

JS

              
                
const superContainer = $('#main-wrap');
const gsapWrap = $('#gsap-wrap');
const slidesWrap = $('#slides-container');
const nav = $('<div class="navigator"></div>');
let navEvent = false;
const panels = [];

// Creating navigation:
// ===========================================================
slidesWrap.find('[data-custom-toggle="gsap-me-hard"]').each(function(index) {
  panels.push(this);
  let opt = $(this).attr('data-custom-options');
  opt = "JSON" in window ? JSON.parse(opt) : $.parseJSON(opt);
  const item = $('<a href="'+opt.id+'" class="spy-item"><i class="bar"></i></a>');
  item.append('<span>'+opt.title+'</span>');
  item.append('<small>'+opt.subtitle+'</small>');
  item.click(function(ev) {
    if (!item.hasClass('active')) {
      gsap.to(window, {
        duration: 0.3,
        scrollTo: opt.id,
        onStart: () => {
          console.log('setting navEvent')
          navEvent = opt.id;
          nav.find('.spy-item').removeClass('active');
        },
        onComplete: () => {
          nav.find('.spy-item[href="#'+navEvent+'"]').addClass('active');
          console.log('removing navEvent')
          navEvent = false;
        }
      });
      resizeSpyItems();
    }
  });
  nav.append(item);
});
gsapWrap.append(nav);

const resizeSpyItems = function () {
  nav.find('.spy-item').each(function () {
    const next = $(this).next();
    if (next.length > 0) {
      const h = next.offset().top - $(this).offset().top;
      $(this).find('.bar').css('height', h);
    }
  });
};

$(window).resize(resizeSpyItems);
resizeSpyItems();

// Starting GSAP:
// ===========================================================
gsap.registerPlugin(ScrollTrigger);

superContainer.find('.scroll-info').click(function() {
  gsap.to(window, {
    duration: 0.3,
    scrollTo: panels[0],
  });
});

// Navigator animation: Reveal / Hide
gsap.to(nav.get(0), {
  scrollTrigger: {
    trigger: slidesWrap.get(0),
    start: 'top 25%',
    end: 'bottom 75%',
    onToggle: (self) => {
      nav.toggleClass('revealed');
    },
  }
});



// Panels animations:
//-------------------------------------------
const panelOnEnter = function (panel) {
  if (navEvent === false) {
    nav.find('.spy-item').removeClass('active');
    nav.removeClass('dark');

    let opt = $(panel).attr('data-custom-options');
    opt = "JSON" in window ? JSON.parse(opt) : $.parseJSON(opt);
    nav.find('.spy-item[href="'+opt.id+'"]').addClass('active');
    if (opt.dark) {
      nav.addClass('dark');
    }
  }
};

panels.forEach((panel, i) => {

  const tl = gsap.fromTo(
    panel,
    {zIndex: -1},
    {zIndex: 1},
  );

  const st = ScrollTrigger.create({
    animation: tl,
    trigger: panel,
    start: "20% 80%",
    end: "80% 20%",
    id: panel.id,
    scrub: 0.2,
    // pin: true,
    // pinSpacing: false,
    // anticipatePin: 1,
    // snap: 1 / (panels.length - 1),
    // snap: .80,
    onEnter: (self) => {
      panelOnEnter(panel);
    },
    onEnterBack: (self) => {
      panelOnEnter(panel);
    },
    // onLeave: (self) => {
    //   nav.find('.spy-item[href="#'+panel.id+'"]').removeClass('active');
    // },
    // onLeaveBack: (self) => {
    //   nav.find('.spy-item[href="#'+panel.id+'"]').removeClass('active');
    // }
    onUpdate: (self) => {

    },
  });

});
              
            
!
999px

Console