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

              
                <!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>Sandbox</title>
</head>

<body>

<div class="nav"><a href="#!" class="link">Section 5</a></div>

<div class="main">
    <section class="green section intro-section"><h1>Section 1</h1></section>
    <section class="pink section quote-section"><h1>Section 2</h1></section>
    <section class="blue section work-section"><h1>Section 3</h1></section>
    <section class="gray section culture-section"><h1>Section 4</h1></section>
    <section class="green section people-section"><h1>Section 5</h1></section>
    <section class="pink section principles-section"><h1>Section 6</h1></section>
    <section class="blue section news-section"><h1>Section 7</h1></section>
    <section class="gray section contact-section"><h1>Section 8</h1></section>
</div>

</body>
</html>

              
            
!

CSS

              
                body{padding:0;margin:0;color:white;font-family:'Helvetica';}
h1 {font-size:75px;}

.main {height:1000vh;}
.section {display:none;align-items:center;justify-content:center;z-index:0;width:100vw;height:100vh;position:fixed;opacity:1;font-size:70px;}

.nav{position:fixed;top:0;width:100%;text-align:center;z-index:20000;}
.nav a {padding:30px;background:#333;font-size:20px;display:block;color:white;}

.intro-section {z-index:100;}
.quote-section {z-index:300;}
.work-section {z-index:500;}
.culture-section {z-index:700;}
.people-section {z-index:900;}
.principles-section {z-index:1100;}
.news-section {z-index:1300;}
.contact-section {z-index:1500;}

.section.green {background:lightgreen;}
.section.pink {background:lightpink;}
.section.blue {background:lightblue;}
.section.gray {background:lightgray;}

.intro-section {display:flex;opacity:1;}
              
            
!

JS

              
                $(document).ready( function() {

    ScrollTrigger.matchMedia({

        "(min-height:200px)" : function() {

            const timeline = gsap.timeline({
                scrollTrigger: { trigger: ".main", start: "top top",
                    end: "bottom bottom", scrub: true, markers: false, // scrub: 1.5
                    toggleActions:"restart none none reset",
                    snap: { snapTo: "labels", delay: 0.001,
                        duration: {min: .5, max: .5}, ease: "power1.inOut" }
                },
            });

            timeline.to(".intro-section", {opacity:1,duration:.1},'<');
            timeline.addLabel("intro-section");
            timeline.to(".intro-section", {opacity:0,duration:.5});

            timeline.to(".quote-section", {display:'flex',opacity:0,duration:0},"<");
            timeline.to(".quote-section", {opacity:1,duration:.5},"<");
            timeline.to(".quote-section h1", {opacity:0,y:200,duration:0},"<");
            timeline.to(".quote-section h1", {opacity:1,y:0,duration:3},"<");
            timeline.addLabel("quote-section");
            timeline.to(".quote-section", {opacity:0,duration:1});

            timeline.to(".work-section", {display:'flex',opacity:0,duration:0},"<");
            timeline.to(".work-section", {opacity:1,duration:1},"<");
            timeline.to(".work-section h1", {opacity:0,y:200,duration:0},"<");
            timeline.to(".work-section h1", {opacity:1,y:0,duration:3},"<");
            timeline.addLabel("work-section");
            timeline.to(".work-section", {opacity:0,duration:1});

            timeline.to(".culture-section", {display:'flex',opacity:0,duration:0},"<");
            timeline.to(".culture-section", {opacity:1,duration:1},"<");
            timeline.to(".culture-section h1", {opacity:0,y:200,duration:0},"<");
            timeline.to(".culture-section h1", {opacity:1,y:0,duration:3},"<");
            timeline.addLabel("culture-section");
            timeline.to(".culture-section", {opacity:0,duration:1});

            timeline.to(".people-section", {display:'flex',opacity:0,duration:0},"<");
            timeline.to(".people-section", {opacity:1,duration:1},"<");
            timeline.to(".people-section h1", {opacity:0,y:200,duration:0},"<");
            timeline.to(".people-section h1", {opacity:1,y:0,duration:3},"<");
            timeline.addLabel("people-section");
            timeline.to(".people-section", {opacity:0,duration:1});

            timeline.to(".principles-section", {display:'flex',opacity:0,duration:0},"<");
            timeline.to(".principles-section", {opacity:1,duration:1},"<");
            timeline.to(".principles-section h1", {opacity:0,y:200,duration:0},"<");
            timeline.to(".principles-section h1", {opacity:1,y:0,duration:3},"<");
            timeline.addLabel("principles-section");
            timeline.to(".principles-section", {opacity:0,duration:1});

            timeline.to(".news-section", {display:'flex',opacity:0,duration:0},"<");
            timeline.to(".news-section", {opacity:1,duration:1},"<");
            timeline.to(".news-section h1", {opacity:0,y:200,duration:0},"<");
            timeline.to(".news-section h1", {opacity:1,y:0,duration:3},"<");
            timeline.addLabel("news-section");
            timeline.to(".news-section", {opacity:0,duration:1});

            timeline.to(".contact-section", {display:'flex',opacity:0,duration:0},"<");
            timeline.to(".contact-section", {opacity:1,duration:1},"<");
            timeline.to(".contact-section h1", {opacity:0,y:200,duration:0},"<");
            timeline.to(".contact-section h1", {opacity:1,y:0,duration:3},"<");
            timeline.addLabel("contact-section");

            $('.link').click(function() {
                var position = timeline.scrollTrigger.start + (timeline.scrollTrigger.end - timeline.scrollTrigger.start) * (timeline.labels['people-section'] / timeline.duration());
                gsap.set(window, {scrollTo: position});
            });

        }

    });

});
              
            
!
999px

Console