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="loader-bg">
         <div class="percentage">' 0%</div>
         <div class="loader-text">
            LOADING
         </div>
      </div>
<div id="smooth-wrapper">
  <div id="smooth-content">
    <section class="content">
      <img height='874' src='https://source.unsplash.com/random/1240x874?sig=206' width='1240'>
      <img height='874' src='https://source.unsplash.com/random/1240x874?sig=206' width='1240'>
      <img height='874' src='https://source.unsplash.com/random/1240x874?sig=206' width='1240'>
      <img height='874' src='https://source.unsplash.com/random/1240x874?sig=206' width='1240'>
      <img height='874' src='https://source.unsplash.com/random/1240x874?sig=206' width='1240'>
      <img height='874' src='https://source.unsplash.com/random/1240x874?sig=206' width='1240'>
      <img height='874' src='https://source.unsplash.com/random/1240x874?sig=206' width='1240'>
    </section>
    <div class="padding"></div>
   

<div class="padding"></div>
   </div>
</div>
              
            
!

CSS

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

* {
  margin: 0;
  padding: 0;
  outline: none;
  border: none;
  box-sizing: border-box;
  text-decoration: none;
  list-style: none;
  box-shadow: none;
}

body {
  font-family: "Roboto", sans-serif;
  color: #fff;
  overscroll-behavior: none;
  position:relative; 
  overflow:hidden;
}
.loader-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #111;
  pointer-events: none;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.percentage {
  font-size: clamp(5.72rem, 15.02vw + 1.97rem, 19.99rem);
}

.loader-text {
  width: 100%;
  text-align: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  font-size: clamp(5.72rem, 27.2vw + -1.08rem, 31.57rem);
  visibility: hidden;
  display: inline-block;
  letter-spacing: -1.3vw;
  margin-right: 1.3vw;
}

.content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 100px;
}

.padding {
  width: 100%;
  height: 50vh;
}

img {
    max-width: 100%;
  height: auto;
  }

.c-exp-gallery__slider {
  position: relative;
}

.proxy {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
}

img {
  display: block;
  width: 100%;
  height: auto;
}

.c-exp-gallery {
  padding-bottom: calc(500 * (100vw / 1440));
}
.c-exp-gallery__slider {
  width: 100vw;
}
.c-exp-gallery__inner {
  white-space: nowrap;
}
.c-exp-gallery-slide {
  display: inline-block;
  position: relative;
  padding: 0 calc(60 * (100vw / 1440));
}
.c-exp-gallery-slide__img {
  width: 50vw;
}
.c-exp-gallery-slide__content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding-top: calc(35 * (100vw / 1440));
}
              
            
!

JS

              
                // Original demo by @GreenSock - https://codepen.io/GreenSock/pen/JawEyN

(function() {
   "use strict";
gsap.registerPlugin(ScrollTrigger, ScrollSmoother, Draggable, InertiaPlugin);

const mm = gsap.matchMedia();

let smoother;

const wrapImg = gsap.utils.toArray("img");
   const percentage = document.querySelector(".percentage");
   const loaderText = document.querySelectorAll(".loader-text");
   const loaderBg = document.querySelector(".loader-bg");
   const updateProgress = (instance) => percentage.textContent = `' ${Math.round(instance.progressedCount * 100 / wrapImg.length)}%`;
   const Preload = () => {
      document.scrollingElement.scrollTo(0, 0);
      var tl = gsap.timeline({
         onComplete: () => {
            document.body.style.overflow = "auto";
            smoother.paused(false);
         },
      });
      tl.to(percentage, {
         yPercent: -10,
         autoAlpha: 0,
         duration: 1.8
      })
      .set(loaderText, { perspective: 400 })
      .from(loaderText, {
         autoAlpha: 0,
         color: "random(['#ccd0db', '#615651', '#BF9865', '#455d7a', '#fbf2d5'])",
         duration: 2.8,
         scale: 0,
         y: 80,
         rotationX: 270,
         transformOrigin: "0% 50% -50",
         ease: "back",
         stagger: 0.3,
      }, "-=.6")
      .to(loaderText, {
         autoAlpha: 0,
         y: -50,
         color: "random(['#ccd0db', '#615651', '#BF9865', '#455d7a', '#fbf2d5'])",
         stagger: 0.2,
         duration: 2
      }, "-=.6")
      .to(loaderBg, {
         autoAlpha: 1,
         yPercent: -100,
         duration: 1.2,
         ease: "expo.inOut"
      }, "-=.2")
   };
   
   imagesLoaded(wrapImg).on("progress", updateProgress).on("always", Preload);

const createFadeTweens = () => {
  
window.addEventListener('load', (event) => {
gsap.config({ trialWarn: false });

const container = document.querySelector(".js-experience-slider");
const proxy = container.querySelector(".proxy");
const slider = document.querySelector(".js-experience-slider__inner");
const sliderContent = document.querySelector(".js-experience-slider__content");
const slides = [...container.querySelectorAll(".js-experience-slide")];

let sliderWidth = 0;
let prevSliderWidth = 0;
// let pressedTop = false;
let offset = 0;

const setBounds = () => {
  prevSliderWidth = sliderWidth;

  sliderWidth = slides[0].offsetWidth * slides.length;

  const newX =
    (sliderWidth / 100) *
    (gsap.getProperty(proxy, "x") / (prevSliderWidth / 100));

  gsap.to([slider, proxy], { width: sliderWidth, x: newX });
};

setBounds();
window.addEventListener("resize", throttle(300, false, setBounds));

const draggable = Draggable.create(proxy, {
  type: "x",
  trigger: container,
  bounds: container,
  zIndexBoost: false,
  throwProps: true,
  edgeResistance: 0.75,
  // edgeResistance: 1,
  dragResistance: 0.4,
  onPress: function (e) {
    var bounds = this.target.getBoundingClientRect();
    // pressedTop = e.clientY < bounds.y + bounds.height / 2;

    //keep track of how far apart the proxy is from the slider because when the user presses down, we want to IMMEDIATELY stop any motion, thus this offset value becomes baked in until release.
    // offset = this.x - slider._gsTransform.x;
    offset = this.x - gsap.getProperty(proxy, "x");

    gsap.killTweensOf(slider); //in case it's moving
    gsap.to(slider, { skewX: 0, duration: 0.2 });
  },
  onDrag: function () {
    gsap.to(slider, {
      duration: 0.8,
      x: () => this.x - offset,
      skewX: function (v) {
        var skew = InertiaPlugin.getVelocity(proxy, "x") / 200;

        // return pressedTop ? -skew : skew;
        return gsap.utils.clamp(-10, 10, skew);
      },
      overwrite: "auto",
      ease: "power2"
    });
  },
  onRelease: function () {
    // if the user just presses down and releases without really moving much at all, there's no need to do a throwProps tween.

    let velocity = InertiaPlugin.getVelocity(proxy, "x");

    if (this.tween && Math.abs(velocity) > 20) {
      gsap.to(slider, {
        overwrite: "auto",
        inertia: { x: { velocity, end: this.endX } }
      });
    }

    gsap.to(slider, { skewX: 0, duration: 0.5, overwrite: "auto" });
  }
});
  });
   };

mm.add("(min-width: 800px)", () => {
  let skewSetter = gsap.quickTo(".js-skew", "skewY"), // fast
    clamp = gsap.utils.clamp(-20, 20); // don't let the skew go beyond 20 degrees.

  smoother = ScrollSmoother.create({
    wrapper: "#smooth-wrapper",
    content: "#smooth-content",
    smooth: 2,
    normalizeScroll: true,
    ignoreMobileResize: true,
    effects: true,
    onUpdate: (self) => skewSetter(clamp(self.getVelocity() / -150)),
    onStop: () => skewSetter(0)
  });
  
  createFadeTweens();

   return () => {
            smoother.kill();
            revertItems();
        }
});

mm.add("(max-width: 767px)", () => {
        createFadeTweens();
        return () => revertItems();
    });

smoother.paused(true); // Preload
ScrollTrigger.refresh()
})(); //"use strict";
              
            
!
999px

Console