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

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

              
                <header class="header js--header" data-section-name="header">
    <h1 class="header__title">Header Content</h1>
</header>

<nav class="section-navigate js--navigate">
    <ul class="section-navigate__items js--navigate-items">
        <li class="section-navigate__item">
            <a href="#first" class="section-navigate__link js--navigate-link is--active">
                <span class="section-navigate__name">First</span>
            </a>
        </li>
        <li class="section-navigate__item">
            <a href="#second" class="section-navigate__link js--navigate-link">
                <span class="section-navigate__name">Second</span>
            </a>
        </li>
        <li class="section-navigate__item">
            <a href="#third" class="section-navigate__link js--navigate-link">
                <span class="section-navigate__name">Third</span>
            </a>
        </li>
        <li class="section-navigate__item">
            <a href="#fourth" class="section-navigate__link js--navigate-link">
                <span class="section-navigate__name">Fourth</span>
            </a>
        </li>
        <li class="section-navigate__item">
            <a href="#fifth" class="section-navigate__link js--navigate-link">
                <span class="section-navigate__name">Fifth</span>
            </a>
        </li>
    </ul>
</nav>

<section class="section__first is--scrolled js--scrollify" data-section-name="first">
    <img src="http://lorempixel.com/1280/720/nature" alt="" />
    <div class="section__first-content">
        <h1 class="section__first-title animated js--first-title">Lorem ipsum dolor sit amet, consectetur adipisicing</h1>
    </div>
</section>

<section class="section__second is--scrolled js--scrollify" data-section-name="second">
    <div class="section__second-container">
        <div class="section__second-card animated js--section-card">
            <h4 class="section-card__title">Lorem ipsum dolor sit amet consectetur</h4>
            <div class="section-card__img">
                <img src="http://www.lorempixel.com/250/120" alt="" />
            </div>
            <div class="section-card__content">
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Expedita fugiat numquam, neque recusandae, provident perspiciatis dolorem cum nulla molestias molestiae delectus, labore nihil quo deserunt maxime voluptatum unde cumque dolor.</p>
            </div>
        </div>
        <div class="section__second-card animated js--section-card">
            <h4 class="section-card__title">Lorem ipsum dolor sit amet consectetur</h4>
            <div class="section-card__img">
                <img src="http://www.lorempixel.com/250/120" alt="" />
            </div>
            <div class="section-card__content">
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium nam perspiciatis ipsa, quidem eum eveniet quisquam excepturi, cumque rem placeat eos quos voluptatem quibusdam possimus doloremque voluptas, sequi similique magnam.</p>
            </div>
        </div>
        <div class="section__second-card animated js--section-card">
            <h4 class="section-card__title">Lorem ipsum dolor sit amet consectetur</h4>
            <div class="section-card__img">
                <img src="http://www.lorempixel.com/250/120" alt="" />
            </div>
            <div class="section-card__content">
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad fugit amet perspiciatis aliquam, nihil voluptates eum sapiente fuga, quidem necessitatibus rerum natus inventore deleniti id sunt, numquam incidunt facere consequuntur.</p>
            </div>
        </div>
    </div>
</section>

<section class="section__third is--scrolled js--scrollify js--third" data-section-name="third">
    <h2 class="section__third-title animated js--third-title">Third</h2>
    
    <div class="section__third-container">
        <div class="section__third-left animated js--third-left">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt exercitationem reiciendis eius consequuntur fugit quos nulla natus, aperiam tenetur dolor unde aliquam sequi consequatur culpa est nemo incidunt ipsa veritatis! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur adipisci autem porro eius natus totam necessitatibus consectetur maxime quae culpa? Amet sunt neque velit porro officia alias possimus est doloribus!
        </div>
        <div class="section__third-right animated js--third-right">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Non maxime odit cum quod blanditiis facilis nobis repellat id nulla, debitis architecto ipsam, suscipit tempora et itaque ut totam eveniet necessitatibus. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus rerum eaque vel inventore ipsum, consequatur perferendis aliquam est dolor facilis illum impedit. Itaque, dignissimos recusandae tempora magnam explicabo distinctio iste.
        </div>
    </div>
</section>

<section class="section__fourth is--scrolled js--scrollify" data-section-name="fourth">
    <h2 class="section__fourth-title">Non-dynamic height section</h2>
    <p class="section__fourth-content">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut eaque illum totam saepe. Temporibus, dicta quod maiores dolorum harum numquam voluptates voluptatem placeat odit. Assumenda nemo omnis laboriosam sint eaque.</p>
</section>

<section class="section__fifth is--scrolled js--scrollify" data-section-name="fifth">Fifth</section>

<footer class="footer js--footer" data-section-name="footer">
    <p class="footer__text">Footer Section</p>
    <p class="footer__copyright">Copyright (c)</p>
</footer>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Lato:100,300,400,700');

*,
*:before,
*:after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

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

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

body {
    font-family: 'Lato', sans-serif;
    overflow-x: hidden;
}

.header {
    background: rgba(#eee, .5);
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: all .3s ease;
    
    &.is--active {
        opacity: 1;
        position: fixed;
    }
    
    &__title {
        margin: 0;
        padding-top: 10px;
        padding-bottom: 10px;
        text-transform: uppercase;
        color: white;
        text-align: center;
        font-weight: 300px;
    }
}

.footer {
    background: #333;
     color: #eee;
     
    &__copyright {
        text-align: center;
        font-weight: 300;
         margin: 0;
         padding-bottom: 12px;
    }
     
     &__text {
          text-align: center;
          text-transform: uppercase;
          margin: 0;
          padding-top: 16px;
          padding-bottom: 16px;
     }
}

.section-navigate {
    position: fixed;
    top: 50%;
    right: 1em;
    transform: translateY(-50%);
    z-index: 1031;
    opacity: 1;
    transition: opacity .05s ease;
    
    &.is--inactive {
        opacity: 0;
    }
    
    &__items {        
        &:before {
            content: '';
            width: 1px;
            height: 180%;
            background: linear-gradient(
                transparent 0,
                white 15%,
                white 85%,
                transparent
            );
            display: block;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
    }
    
    &__link {
        text-decoration: none;
        position: relative;
        
        &:before {
            content: '\25CF';
            width: 20px;
            height: 20px;
            font-size: 13px;
            line-height: 26px;
            color: white;
            position: relative;
            left: 2px;
        }
        
        &:hover {
            .section-navigate__name {
                opacity: 1;
            }
        }
        
        &.is--active {
            &:before {
                content: '\25CF';
                width: 20px;
                height: 20px;
                font-size: 20px;
                left: 0;
            }
        }
    }
    
    &__name {
        position: absolute;
        top: 5px;
        right: 23px;
        color: white;
        font-size: 12px;
        text-transform: uppercase;
        font-weight: 100;
        letter-spacing: 2px;
        opacity: 0;
        transition: opacity .5s ease;
    }
}

.section {
    &__first,
    &__second,
    &__third,
    &__fourth,
    &__fifth {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        font-size: 6em;
        text-transform: uppercase;
        font-weight: bold;
        font-weight: 300;
        color: white;
        transition: opacity .4s ease;
        
        &.is--inactive {
            opacity: 0;
        }
    }
    
    &__first {
        position: relative;
    }
    
    &__first-content {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(black, .5);
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    &__first-title {
        font-size: 36px;
        text-align: center;
        line-height: 1.5;
        width: 85%;
    }
    
    &__second {
        background: seagreen;
        
        .section-card {
            &__content,
            &__title {
                text-align: center;
            }
            
            &__title {
                font-size: 16px;
            }
            
            &__content {
                font-size: 14px;
                text-transform: none;
                line-height: 1.4;
                letter-spacing: 1px;
            }
        }
    }
    
    &__second-card {
        width: 27.5%;
        margin-left: 20px;
        margin-right: 20px;
        background: rgba(black, .15);
        padding: 10px;
        box-shadow: 1px 1px 7px black;
    }
    
    &__second-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    &__third {
        background: steelblue;
        display: flex;
        flex-direction: column;
    }
    
    &__third-container {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    &__third-left,
    &__third-right {
        font-size: 12px;
        width: 40%;
        line-height: 1.5;
        padding-left: 20px;
        padding-right: 20px;
        text-align: center;
    }
    
    &__third-title {
        text-align: center;
        margin: 10px;
    }
    
    &__fourth {
        background: gold;
        color: #444;
    }
    
    &__fourth-content {
        font-size: 12px;
        font-weight: 400;
        text-align: center;
        margin-bottom: 36px;
        line-height: 1.4;
    }
    
    &__fourth-title {
        margin-top: 80px;
        font-size: 36px;
        font-weight: 600;
        text-align: center;
    }
    
    &__fifth {
        position: relative;
        font-weight: 100;
        color: #333;
        background: radial-gradient(
            center,
            lightgrey,
            white
        );
    }
}
              
            
!

JS

              
                
$(function () {
    'use strict';
    
    const elements = {
        scrollify: $('.js--scrollify'),
        header: $('.js--header'),
        footer: $('.js--footer'),
        navigate: $('.js--navigate'),
        navigateItems: $('.js--navigate-items'),
        navigateLink: $('.js--navigate-link'),
        firstTitle: $('.js--first-title'),
        third: $('.js--third'),
        thirdTitle: $('.js--third-title'),
        thirdLeft: $('.js--third-left'),
        thirdRight: $('.js--third-right'),
        sectionCard: $('.js--section-card'),
        block: $('.js--block'),
        more: $('.js--more'),
    };
    
    elements.navigateItems.on('click', '.js--navigate-link', (ev) => {
        ev.preventDefault();
        
        const $this = $(ev.currentTarget);
        const hash = $this.attr('href');
        
        $.scrollify.move(hash);
    });
    
    elements.more.on('click', (ev) => {
        elements.block.slideToggle();
    });
    
    setTimeout( () => {
        elements.firstTitle.addClass('bounceInDown');
    }, 100);
    
    $.scrollify({
        section: '.js--scrollify',
		sectionName : 'section-name',
        overflowScroll: false,
        setHeights: true,
        interstitialSection: '.footer, .section__fourth',
        standardScrollElements: '.footer',
		before (index, sections) {
            const ref = sections[index].data('section-name');
            
            if ( ref === 'first' || ref === 'footer' ) {
                elements.header.removeClass('is--active');
                elements.firstTitle.addClass('bounceInDown');
            }
            
            if ( ref === 'second' ) {
                setTimeout( function () {
                    elements.sectionCard.addClass('flipInY');
                }, 100);
            }
            
            if ( ref === 'third' ) {
                elements.third.removeClass('is--inactive');
                elements.thirdLeft.addClass('fadeInLeft');
                elements.thirdRight.addClass('fadeInRight');
                elements.thirdTitle.addClass('bounceInDown');
            }
            
            if ( ref === 'footer' ) {
                elements.navigate.addClass('is--inactive');
            } else {
                elements.navigate.removeClass('is--inactive');
            }
            
            elements.navigateLink.parent().siblings().find('.js--navigate-link').removeClass('is--active');
            elements.navigateLink.eq(index).addClass('is--active');
        },
		after: function (index, sections) {
            var ref = sections[index].data('section-name');
            
            if ( ref !== 'second' ) {
                elements.sectionCard.removeClass('flipInY');
            }
            
            if ( ref === 'third' ) {
                elements.thirdLeft.removeClass('fadeInLeft');
                elements.thirdRight.removeClass('fadeInRight');
                elements.thirdTitle.removeClass('bounceInDown');
            }
            
            if ( ref !== 'third' ) {
                elements.third.addClass('is--inactive');
            }
            
            if ( ref !== 'first' && ref !== 'footer' ) {
                elements.header.addClass('is--active');
                elements.firstTitle.removeClass('bounceInDown');
            }
        },
        afterRender () {},
    });
});
              
            
!
999px

Console