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

              
                <div class="center-mark"></div>
<div class="doors">
  <div class="door-container door-container-left">
    <div class="door door-left"></div>
  </div>
  <div class="door-container door-container-right">
    <div class="door door-right"></div>
  </div>
</div>

<div class="content">
  <div class="content-container content-home" id="content-home">
    Lorem Ipsum is simply dummy text of<br />the printing and typesetting
    industry.
  </div>
</div>

<div class="scroll-container">
  <section class="section initial">Initial</section>
  <section class="section home-in">Home In</section>
  <section class="section home">Home</section>
  <section class="section home-out">Home Out</section>
  <section class="section spacer">Spacer</section>
  <section class="section home-in">Home In</section>
  <section class="section home">Home</section>
  <section class="section home-out">Home Out</section>
  <section class="section spacer">Spacer</section>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Open+Sans&display=swap");

body {
  background-color: #333333;
  font-family: sans-serif;
  margin: 0;
  padding: 0;
}

/*! locomotive-scroll v4.1.3 | MIT License | https://github.com/locomotivemtl/locomotive-scroll */
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;
}

[data-scroll-direction="horizontal"] [data-scroll-container] {
  height: 100vh;
  display: inline-block;
  white-space: nowrap;
}

[data-scroll-direction="horizontal"] [data-scroll-section] {
  display: inline-block;
  vertical-align: top;
  white-space: nowrap;
  height: 100%;
}

.c-scrollbar {
  position: absolute;
  right: 0;
  top: 0;
  width: 11px;
  height: 100%;
  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;
}
[data-scroll-direction="horizontal"] .c-scrollbar {
  width: 100%;
  height: 10px;
  top: auto;
  bottom: 0;
  transform: scaleY(1);
}
[data-scroll-direction="horizontal"] .c-scrollbar:hover {
  transform: scaleY(1.3);
}

.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;
}
[data-scroll-direction="horizontal"] .c-scrollbar_thumb {
  right: auto;
  bottom: 0;
}

/* Center Mark */

.center-mark {
  background-color: black;
  height: 100vh;
  left: 50%;
  position: fixed;
  top: 0;
  transform: translateX(-1px);
  width: 2px;
  z-index: 7000;
}

/* Doors */

.doors {
  align-items: center;
  display: flex;
  justify-content: center;
  left: 50%;
  opacity: 1;
  pointer-events: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5000;
  width: 100%;
}

.door-container {
  display: flex;
  height: 300px;
  left: 0;
  position: absolute;
  width: 50%;
}

.door-container-left {
  transform-origin: right center;
  transform: translateX(-100%);
}

.door-container-right {
  transform-origin: left center;
  transform: translateX(0%);
}

.door {
  height: 300px;
  left: 0;
  position: absolute;
  width: 100%;
}

.door-left {
  background-color: orangered;
}

.door-right {
  background-color: orange;
}

/* Content */

.content {
  color: white;
  left: 50%;
  pointer-events: none;
  position: fixed;
  top: 50%;
  z-index: 4000;
}

.content-container {
  font-family: "Open Sans", sans-serif;
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.content-home {
  font-size: 30px;
}

/* @media (min-width: 480px) {

}

@media (min-width: 720px) {
  
} */

@media (min-width: 1024px) {
  .content-home {
    font-size: 60px;
  }
}

/* Sections */

.section {
  color: rgba(255, 255, 255, 0.8);
  background-color: #333333;
  border-bottom: 1px solid #111111;
  font-size: 14px;
  min-height: 100vh;
  padding: 20px 0 0 20px;
  text-transform: uppercase;
  width: 100%;
}

.section.home {
  min-height: 200vh;
}

              
            
!

JS

              
                // import "./styles.css";

// import gsap from "gsap";
// import { ScrollTrigger } from "gsap/ScrollTrigger";
// import LocomotiveScroll from "locomotive-scroll";

(function () {
  gsap.registerPlugin(ScrollTrigger);

  // ---------------------------------------------------------------
  // Locomotive Scroll
  // ---------------------------------------------------------------

  const scrollContailerClass = ".scroll-container";

  const locoScroll = new LocomotiveScroll({
    el: document.querySelector(scrollContailerClass),
    smooth: true,
    multiplier: 0.5
  });

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

  // ---------------------------------------------------------------
  // ScrollTrigger
  // ---------------------------------------------------------------

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

  // ---------------------------------------------------------------
  // Greensock
  // ---------------------------------------------------------------

  // Opening doors

  const contentHome = document.getElementById("content-home");
  let startSections = document.querySelectorAll(".home-in");
  let endSections = document.querySelectorAll(".home-out");

  startSections.forEach((section) => {
    gsap.fromTo(
      ".door-left",
      { x: 0 },
      {
        x: () => `${-contentHome.offsetWidth / 2}px`,
        ease: "power1.inOut",
        duration: 4,
        scrollTrigger: {
          trigger: section,
          scroller: scrollContailerClass,
          start: "top bottom",
          end: "bottom top",
          markers: true,
          scrub: true,
          invalidateOnRefresh: true
        }
      }
    );

    gsap.fromTo(
      ".door-right",
      { x: 0 },
      {
        x: () => `${contentHome.offsetWidth / 2}px`,
        ease: "power1.inOut",
        duration: 4,
        scrollTrigger: {
          trigger: section,
          scroller: scrollContailerClass,
          start: "top bottom",
          end: "bottom top",
          scrub: true,
          invalidateOnRefresh: true
        }
      }
    );
  });

  endSections.forEach((section) => {
    // Closing doors

    gsap.to(".door-left", {
      x: 0,
      ease: "power1.inOut",
      duration: 4,
      immediateRender: false,
      scrollTrigger: {
        trigger: section,
        scroller: scrollContailerClass,
        start: "top bottom",
        end: "bottom top",
        markers: true,
        scrub: true,
        invalidateOnRefresh: true
      }
    });

    gsap.to(".door-right", {
      x: 0,
      ease: "power1.inOut",
      duration: 4,
      immediateRender: false,
      scrollTrigger: {
        trigger: section,
        scroller: scrollContailerClass,
        start: "top bottom",
        end: "bottom top",
        scrub: true,
        invalidateOnRefresh: true
      }
    });
  });

  ScrollTrigger.addEventListener("refresh", () => locoScroll.update());
  ScrollTrigger.refresh();
})();

              
            
!
999px

Console