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 class="smooth-scroll" id="scroll">
  

<div class="slider-years parallax--horizontal">
  
  <div class="slider-years--img">
    <img class="first-img" style="z-index: 1;" src="https://dummyimage.com/600x600/f08e29/ffffff.png&text=C" alt="" />
    <img style="z-index: 2;" src="https://dummyimage.com/600x600/32c4e4/ffffff.png&text=D" alt="" />
    <img style="z-index: 3;" src="https://dummyimage.com/600x600/f08e29/ffffff.png&text=C" alt="" />
    <img style="z-index: 4;" src="https://dummyimage.com/600x600/32c4e4/ffffff.png&text=D" alt="" />
  </div>
  
  <div class="slider-years-text">
    <div class="panel">
      <a data-video="" class="first-panel"> <span class="bigTitle">1990</span> <span class="littleIntrduction">Il Mondo nuovo</span></a>
    </div>
    <div class="panel">
      <a data-video=""> <span class="bigTitle">1991</span> <span class="littleIntrduction">Il Mondo nuovo</span></a>
    </div>
    <div class="panel">
      <a data-video=""> <span class="bigTitle">1992</span> <span class="littleIntrduction">Il Mondo nuovo</span></a>
    </div>
    <div class="panel">
      <a data-video=""> <span class="bigTitle">1993</span> <span class="littleIntrduction">Il Mondo nuovo</span></a>
    </div>
  </div>
  
</div>
</div>
              
            
!

CSS

              
                html.has-scroll-smooth {
  overflow: hidden;
}

html.has-scroll-dragging {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.has-scroll-smooth body {
  overflow: hidden;
}

.has-scroll-smooth [data-scroll-container] {
  min-height: 100vh;
}

.c-scrollbar {
  position: absolute;
  right: 0;
  top: 0;
  width: 11px;
  height: 100vh;
  transform-origin: center right;
  transition: transform 0.3s, opacity 0.3s;
  opacity: 0;
}
.c-scrollbar:hover {
  transform: scaleX(1.45);
}
.c-scrollbar:hover,
.has-scroll-scrolling .c-scrollbar,
.has-scroll-dragging .c-scrollbar {
  opacity: 1;
}

.c-scrollbar_thumb {
  position: absolute;
  top: 0;
  right: 0;
  background-color: black;
  opacity: 0.5;
  width: 7px;
  border-radius: 10px;
  margin: 2px;
  cursor: -webkit-grab;
  cursor: grab;
}
.has-scroll-dragging .c-scrollbar_thumb {
  cursor: -webkit-grabbing;
  cursor: grabbing;
}

.parallax--horizontal {
  width: 100%;
  height: 100vh !important;
  display: flex;
  flex-wrap: nowrap;
  background-color: #1c2157;
  overflow: hidden;
  height: auto;
  width: 100%;
  position: relative;
  padding: 0;
  overflow-x: hidden;
}
.parallax-panel {
  display: flex;
  flex: 0 0 75%;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: center;
  height: 100%;
  padding: 10rem 0rem 2rem 0rem;
  background-color: transparent;
  overflow: hidden;
}
.parallax--horizontal .parallax-panel {
  will-change: transform;
}

.slider-years-text {
  position: absolute;
  top: 22%;
  display: flex;
  padding-left: 20vw;
  z-index: 9999;
  a {
    display: flex;
    flex: 0 0 50%;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    justify-content: center;
    height: 100%;
    padding: 10rem 0rem 2rem 0rem;
    background-color: transparent;
    overflow: hidden;
    flex-direction: column;
    .bigTitle {
      /* Heading */

      font-family: Helvetica Now Display;
      font-style: normal;
      font-weight: 500;
      font-size: 220px;
      line-height: 130px;
      /* or 59% */
      display: flex;
      align-items: center;
      text-align: center;

      color: #ffffff;
    }
    .littleIntrduction {
      /* Subheading */

      font-family: Helvetica Now Display;
      font-style: normal;
      font-weight: 500;
      font-size: 36px;
      line-height: 53px;
      display: flex;
      align-items: center;
      text-align: center;

      color: #ffffff;
    }
  }
}

.slider-years--img {
  img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    opacity: 0;
  }
}

.first-img {
  opacity: 1 !important;
}

.section {
  height: 100vh;
  &--large {
    width: 100vw;
    background-color: #e4002b;
    color: white;
  }

  &--small {
    width: 46rem;
  }

  &--dark {
    color: white;
    background-color: black;
  }
}

button {
  background-color: red;

  &.enable {
    background-color: green;
  }
}

.panel {
  width: 50vw;
}





body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/*
.panel a {
  background-color: tomato
}

a.enable .bigTitle {
  color: green
}
*/

.smooth-scroll {
  overflow-y: hidden !important;
}

.panel a.first-panel {
  opacity: 1 !important;
}

.slider-years--img {
  opacity: 0.5
}
              
            
!

JS

              
                gsap.registerPlugin(ScrollTrigger);
document.addEventListener("DOMContentLoaded", function() {

  var locoScroll = new LocomotiveScroll({
    el: document.querySelector("#scroll"),
    smooth: true,
    getDirection: true
  });

  const menuEl = document.querySelector("#scroll");

  locoScroll.on("scroll", ScrollTrigger.update);

  ScrollTrigger.scrollerProxy("#scroll", {
    scrollTop(value) {
      return arguments.length ? locoScroll.scrollTo(value, 0, 0) : locoScroll.scroll.instance.scroll.y;
    }, 
    getBoundingClientRect() {
      return { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight };
    },
    pinType: document.querySelector("#scroll").style.transform ? "transform" : "fixed"
  });



 

  let container = document.querySelector(".parallax--horizontal");
  
  let tl = gsap.timeline({
    scrollTrigger: {
      pin: true,
      scrub: 1,
      scroller: menuEl,
      trigger: container,
      end: () => container.scrollWidth - document.documentElement.clientWidth + container.offsetWidth
    },
    defaults: { ease: "none", duration: 1 }
  });

  tl
    .to(".slider-years-text", { x: () => -( container.scrollWidth - document.documentElement.clientWidth + 600 ) }, 0 )    
    .from(".slider-years-text a", { opacity: 0.4, duration: 0.1, stagger: { amount: 1.0 } }, 0 )
    .to(".slider-years--img img", { opacity: 1, duration: 0.1, stagger: { amount: 1.0 } }, 0 )
  ;
 

  // const buttons = document.querySelectorAll(".panel a");
  
  // buttons.forEach((btn, index) => {
  //   
  //   gsap.to(btn, {
  //     scrollTrigger: {
  //       id: `btn--round-${index}`,
  //       trigger: btn,
  //       toggleClass: "enable",
  //       markers: true,
  //       
  //       scroller: menuEl,
  //       refreshPriority: -1,
  //       start: "0 80%-=" + (btn.offsetLeft),
  //       end: "0 20%-=" + (btn.offsetLeft)
  //     }
  //   });
  //   
  // });
  
  

  // each time the window updates, we should refresh ScrollTrigger and then update LocomotiveScroll.
  ScrollTrigger.addEventListener("refresh", () => locoScroll.update());

  // after everything is set up, refresh() ScrollTrigger and update LocomotiveScroll because padding may have been added for pinning, etc.
  ScrollTrigger.refresh();  
  
});

              
            
!
999px

Console