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

              
                

<body id="">
<div id="smooth-wrapper">
  <div id="smooth-content">
    <div class="home">
        <h1 style="color: red;">
            Scroll Down
        </h1>
    </div>
    <div class="home2">
        <h1 style="color: red;">
            Scroll Down
        </h1>
    </div>
    <div class="container">
        <nav class="navBar">
            This is Header
        </nav>
        <div class="c_1 scroll_x">
            Horizontal Scroll <br>
            <br>
            Scroll -------------->
        </div>
        <div class="c_2 scroll_x">
            Keep Scrolling
        </div>
        <div class="c_3 scroll_x">
            Keep Scrolling
        </div>
        <div class="c_4 scroll_x">
            Keep Scrolling
        </div>
    </div>

    <div class="footer">
        <div class="pin">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quae, quam! Sunt, unde mollitia accusantium ipsa
            similique dolores nisi rerum eum, tenetur natus nemo. <br> <br>
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum asperiores dolore, at cum id quae esse
            reprehenderit quas pariatur! Iure qui sapiente totam maiores adipisci praesentium quisquam assumenda,
            asperiores quaerat error blanditiis perferendis natus quam! Debitis dolorum ducimus ea laboriosam distinctio
            officia, corrupti expedita ullam, nam, qui asperiores ex sunt?
        </div>
        <div class="pin2">
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Amet aperiam totam saepe fugiat voluptate officiis
            minima nulla, debitis sequi quibusdam id nostrum aliquam labore accusamus minus quod! Dolorum, ex incidunt.
        </div>
    </div>
    <div class="footer2">
        Lorem ipsum, dolor sit amet consectetur adipisicing elit. Unde nam doloremque molestias id maxime tenetur
        exercitationem aperiam officia magnam perspiciatis dolorum, quibusdam excepturi animi at consequatur explicabo
        quia, fugiat distinctio.
    </div>
    <div class="footer3">
        Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus amet quae dolor mollitia ea maxime neque
        consectetur, nemo similique, necessitatibus nisi voluptas perspiciatis expedita ad dignissimos natus suscipit,
        quia tempore.
    </div>

    <div class="endFooter">
        This is Footer
    </div>
     </div>
   </div>
</body>


              
            
!

CSS

              
                * {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body {
    overscroll-behavior: none;
    height: 100vh;
}
body::-webkit-scrollbar {
    display: none;
}

.home {
    width: 100vw;
    height: 100vh;
    background-color: rgb(0, 0, 0);
    display: flex;
    justify-content: center;
    align-items: center;
}
.home2 {
    width: 100vw;
    height: 100vh;
    background-color: rgb(245, 230, 230);
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    overscroll-behavior: none;
    width: 400%;
    height: 100vh;
    display: flex;
    flex-wrap: nowrap;
}

.navBar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 30px;
    text-align: center;
    line-height: 30px;
    font-weight: 600;
    background-color: rgb(173, 173, 184);
    z-index: 10;
    font-size: 20px;
}

.c_1 {
    width: 100vw;
    height: 100vh;
    background-color: aqua;
    display: flex;
    justify-content: center;
    align-items: center;
}
.c_2 {
    width: 100vw;
    height: 100vh;
    background-color: rgb(4, 93, 134);
    display: flex;
    justify-content: center;
    align-items: center;
}
.c_3 {
    width: 100vw;
    height: 100vh;
    background-color: antiquewhite;
    display: flex;
    justify-content: center;
    align-items: center;
}

.c_4 {
    width: 100vw;
    height: 100vh;
    background-color: orange;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer {
    display: flex;
    width: 100vw;
    height: 100vh;
    background-color: rgb(42, 63, 56);
}
.pin {
    width: 50vw;
    height: 100vh;
    background-color: rgb(92, 10, 10);
    border: 10px solid black;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
}
.pin2 {
    width: 50vw;
    height: 100vh;
    background-color: rgb(92, 10, 10);
    border: 10px solid rgb(233, 213, 213);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
}

.footer2 {
    width: 50vw;
    margin-left: 50%;
    height: 100vh;
    border: 10px solid rgb(233, 213, 213);
    background-color: rgb(17, 189, 132);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
}
.footer3 {
    width: 50vw;
    margin-left: 50%;
    height: 100vh;
    border: 10px solid rgb(233, 213, 213);
    background-color: rgb(18, 129, 8);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
}
.endFooter {
    width: 100vw;
    height: 30vh;
    background-color: gray;
    text-align: center;
    line-height: 30vh;
    font-size: 30px;
    font-weight: 600;
}

              
            
!

JS

              
                gsap.registerPlugin(ScrollTrigger,ScrollSmoother);

let smoother = ScrollSmoother.create({
  wrapper:'#smooth-wrapper',
  content:"#smooth-content"
})



let section = gsap.utils.toArray('.scroll_x');

let pin = document.querySelector('.pin');
let footer = document.querySelector('.footer');
let footer2 = document.querySelector('.footer2');

console.log(section);

gsap.to(section, {
    xPercent: -100 * (section.length - 1),
    ease: 'none',
    scrollTrigger: {
        trigger: '.container',
        pin: true,
        scrub: 1,
        markers: true,
        snap: 1 / (section.length - 1),
       
        end: '+=3500'
    }
});

gsap.to(pin, {
    scrollTrigger: {
        trigger: '.pin',
        endTrigger: '.footer2',
        pin: true,
        scrub: 1,
        markers: true,
        start: 'top '
        // end: '+=200%'
    }
});

ScrollTrigger.create({
    trigger: '.home',
    start: 'top top',
   
    
 
    
    marker: true,
  snap:1
  
});

ScrollTrigger.create({
    trigger: '.footer2',
    start: 'top top',
    ease: 'power1.inOut',
    snap: 1,

    marker: true
});

              
            
!
999px

Console