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

              
                
    <div id="wrapper">


        <div id="content">

            <nav id="primary">
                <ul>
                    <li>
                        <h1>Intro</h1>
                        <a class="page-number-1" href="#page-number-1">View</a>
                    </li>
                    <li>
                        <h1>Wow!</h1>
                        <a class="page-number-2" href="#page-number-2">View</a>
                    </li>
                    <li>
                        <h1>More stuff...</h1>
                        <a class="page-number-3" href="#page-number-3">View</a>
                    </li>
                    <li>
                        <h1>Last page!</h1>
                        <a class="page-number-4" href="#page-number-4">View</a>
                    </li>
                </ul>
            </nav>

            <!-- Page #1 -->
            <article id="page-number-1">
                <header>
                    <h1>Parallax Demo</h1>
                </header>
                <p>This is a sample Parallax scrolling site with four pages. You can add all kinds of extra navigation elements on your own time, but I just wanted a simple, ready to rollout, vertical parallax system that I could easily implement and edit later.</p>
                <nav class="next-prev">
                    <hr />
                    <a class="next page-number-2" href="#page-number-2">Next</a>
                </nav>
            </article>

            <!-- Page #2 -->
            <article id="page-number-2">
                <header>
                    <h1>Wow!</h1>
                </header>
                <p>Did you like that nice, smooth movement? Pretty slick, eh? You can either scroll or click on the navigation elements below. It's your decision. You're an adult. I'll leave that up to you. </p>
                <nav class="next-prev">
                    <a class="prev page-number-1" href="#page-number-1">Prev</a>
                    <hr />
                    <a class="next page-number-3" href="#page-number-3">Next</a>
                </nav>
            </article>

            <!-- Page #3 -->
            <article id="page-number-3">
                <header>
                    <h1>More stuff...</h1>
                </header>
                <p>You can add as many pages as you want, but it takes some work to get all the CSS, and JS working together. Just remember that each page you add needs to have this HTML, the CSS, and the parallax.js file updated with the new page. Don't worry, you'll be a pro before you know it!</p>
                <nav class="next-prev">
                    <a class="prev page-number-2" href="#page-number-2">Prev</a>
                    <hr />
                    <a class="next page-number-4" href="#page-number-4">Next</a>
                </nav>
            </article>

            <!-- Page #4 -->
            <article id="page-number-4">
                <header>
                    <h1>Last page!</h1>
                </header>
                <p>Of course, there are all kinds of HTML and JS additions you can make. From navigation bars to the Lettering.js jQuery plugin, there's no limit. This parallax technique only relies upon the basic CSS and lightweight jQuery plugins to create the effect. Time for you tweak it and make it your own!</p>
                <nav class="next-prev">
                    <a class="prev page-number-3" href="#page-number-3">Prev</a>
                    <hr />
                </nav>
            </article>

        </div>

        <!-- 
            Parallax  background images 
            To find the CSS, navigate to the CSS file and search for "background images" 
            -->
        <div id="parallax-bg1">
            <img class="cloud" id="bg1-1" src="" alt="cloud" />
            <img class="cloud" id="bg1-2" src="" alt="cloud" />
            <img class="cloud" id="bg1-3" src="" alt="cloud" />
            <img class="cloud" id="bg1-4" src="" alt="cloud" />
            <img class="cloud" id="bg1-5" src="" alt="cloud" />
        </div>

        <!-- 
            Parallax  midground images 
            To find the CSS, navigate to the CSS file and search for "midground images" 
            -->
        <div id="parallax-bg2">

            <img id="mg2-1" src="img/cloud3.png" alt="cloud" />
            <img id="mg2-2" src="img/cloud3.png" alt="cloud" />
            <img id="mg2-3" src="img/cloud3.png" alt="cloud" />
            <img id="mg2-4" src="img/cloud3.png" alt="cloud" />
            <img id="mg2-5" src="img/cloud3.png" alt="cloud" />
            <img id="mg2-6" src="img/cloud3.png" alt="cloud" />
            <img id="mg2-7" src="img/cloud3.png" alt="cloud" />
        </div>

        <!-- 
            Parallax foreground images 
            To find the CSS, navigate to the CSS file and search for "foreground images"
            -->
        <div id="parallax-bg3">
            <!--
            <img id="fg3-1" src="img/twitter.png" width="529" height="386" alt="Big freaking Twitter bird" />
            <img id="fg3-2" src="img/facebook.png" width="603" height="603" alt="Facebook in your face!" />
            <img id="fg3-3" src="img/linkedin.png" width="446" height="446" alt="LinkedIn logo" />
            <img id="fg3-4" src="img/landscape.png" width="1104" height="592" alt="Landscape foreground" />
            <img id="fg3-5" src="img/design-festival-logo.png" width="135" height="136" alt="Bluified Design Festival logo" />
-->
        </div>


    </div>
              
            
!

CSS

              
                /* PARALLAX SCROLLING EXPERIMENT
   Master Styles
   Author: Jonathan Nicol (f6design.com)
*****************************************************************/


/* Global reset
   http://meyerweb.com/eric/tools/css/reset/ 
*****************************************************************/

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
    display: block;
}
body {
    line-height: 1;
}
ol,
ul {
    list-style: none;
}
blockquote,
q {
    quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* Extended base styles (site specific)
*****************************************************************/

html {
    overflow-y: scroll;
    /* always force a scrollbar in non-IE */
}
body {
    /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#1e5799+0,0075d6+0,aecde5+100 */
    background: #1e5799;
    /* Old browsers */
    background: -moz-linear-gradient(-45deg, #1e5799 0%, #0075d6 0%, #aecde5 100%);
    /* FF3.6-15 */
    background: -webkit-linear-gradient(-45deg, #1e5799 0%, #0075d6 0%, #aecde5 100%);
    /* Chrome10-25,Safari5.1-6 */
    background: linear-gradient(135deg, #1e5799 0%, #0075d6 0%, #aecde5 100%);
    /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
    filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#aecde5', GradientType=1);
    /* IE6-9 fallback on horizontal gradient */
    overflow-x: hidden;
    height: 4550px;
    line-height: 1.5;
    color: #000;
    font-size: 14px;
    font-family: Arial, sans-serif;
}
h1 {
    color: #649cc8;
}
a,
a:link,
a:active,
a:visited {
    -webkit-transition: color 0.25s ease-out;
    -moz-transition: color 0.25s ease-out;
    -o-transition: color 0.25s ease-out;
    transition: color 0.25s ease-out;
    color: #649cc8;
    outline: none;
    text-decoration: none;
}
a:hover {
    color: #000;
}
img {
    display: block;
}
p {
    margin: 1em 0;
}

/* Common shared styles
*****************************************************************/

hr {
    margin: 0;
    border: none;
    border-top: 1px solid #3b3b3b;
    border-bottom: 1px solid #3b3b3b;
    height: 3px;
}

/* Page structure
*****************************************************************/

#wrapper {
    position: relative;
}
#branding {
    width: 100%;
    background: #fff;
}
#branding h1 {
    width: 940px;
    padding: 10px 15px;
    margin: 0 auto;
    text-transform: uppercase;
    font-size: 18px;
    font-weight: bold;
}

/* Nav
*****************************************************************/

nav#primary {
    z-index: 5;
    position: fixed;
    top: 50%;
    right: 16px;
    margin-top: -40px;
}
nav#primary li {
    position: relative;
    height: 20px;
}
nav#primary a {
    display: block;
    width: 20px;
    height: 20px;
    text-indent: -9999px;
    background: transparent url('../img/nav-dot.png') 4px 4px no-repeat;
}
nav#primary a:hover,
nav#primary a.active {
    background: transparent url('../img/nav-dot.png') 4px -16px no-repeat;
}
nav#primary h1 {
    position: absolute;
    right: 22px;
    top: -7px;
    display: none;
    padding: 4px 20px 4px 7px;
    ;
    color: #fff;
    white-space: nowrap;
    background: transparent url('../img/nav-arrow.png') 100% 50% no-repeat;
}
nav.next-prev {
    margin: 20px 0 0 0;
}
a.prev,
a.next {
    display: block;
    width: 15px;
    height: 11px;
    text-indent: -9999px;
}
a.prev {
    margin: 0 auto 5px auto;
    background: transparent url('../img/scroll-arrow-up.png') 0 0 no-repeat;
}
a.prev:hover {
    background: transparent url('../img/scroll-arrow-up.png') 0 -11px no-repeat;
}
a.next {
    margin: 5px auto 0 auto;
    background: transparent url('../img/scroll-arrow-down.png') -1px 0 no-repeat;
}
a.next:hover {
    background: transparent url('../img/scroll-arrow-down.png') -1px -11px no-repeat;
}

/* Parallax
*****************************************************************/


/* content */

#content {
    z-index: 4;
    position: relative;
    max-width: 940px;
    padding: 0 10px;
    margin: 0 auto;
    line-height: 1.7;
}
#content article {
    width: 300px;
}
#page-number-1,
#page-number-2,
#page-number-3,
#page-number-4 {
    padding-top: 105px;
}
#page-number-1 {
    position: absolute;
    top: 0px;
}
#page-number-2 {
    position: absolute;
    top: 1090px;
}
#page-number-3 {
    position: absolute;
    top: 2180px;
}
#content h1 {
    margin: 0 0 25px 0;
    font-size: 60px;
    font-family: Georgia, serif;
    font-weight: normal;
    line-height: 65px;
}
#page-number-4 {
    position: absolute;
    top: 3270px;
}

/* foreground */

#parallax-bg3 {
    z-index: 3;
    position: fixed;
    left: 50%;
    /* align left edge with center of viewport */
    top: 0;
    width: 940px;
    margin-left: -470px;
    /* move left by half element's width */
}

/* foreground images */

#fg3-1 {
    position: absolute;
    top: -11px;
    left: 355px;
}
#fg3-2 {
    position: absolute;
    top: 812px;
    left: 321px;
}
#fg3-3 {
    position: absolute;
    top: 1728px;
    left: 403px;
}
#fg3-4 {
    position: absolute;
    top: 2700px;
    left: -85px;
}
#fg3-5 {
    position: absolute;
    top: -25px;
    left: -150px;
}

/* midground images */

#parallax-bg2 {
    z-index: 2;
    position: fixed;
    left: 50%;
    /* align left edge with center of viewport */
    top: 0;
    width: 1200px;
    margin-left: -600px;
    /* move left by half element's width */
}
#mg2-1 {
    position: absolute;
    top: 162px;
    left: 200px;
}
#mg2-2 {
    position: absolute;
    top: 300px;
    left: 650px;
}
#mg2-3 {
    position: absolute;
    top: 543px;
    left: -35px;
}
#mg2-4 {
    position: absolute;
    top: 1180px;
    left: 250px;
}
#mg2-5 {
    position: absolute;
    top: 900px;
    left: 890px;
}
#mg2-6 {
    position: absolute;
    top: 1600px;
    left: 490px;
}
#mg2-7 {
    position: absolute;
    top: 2000px;
    left: 890px;
}

/* background images */

#parallax-bg1 {
    z-index: 1;
    position: fixed;
    left: 50%;
    /* align left edge with center of viewport */
    top: 0;
    width: 1200px;
    margin-left: -600px;
    /* move left by half element's width */
}
#bg1-1 {
    position: absolute;
    top: 85px;
    left: -270px;
}
#bg1-2 {
    position: absolute;
    top: 240px;
    left: 795px;
}
#bg1-3 {
    position: absolute;
    top: 300px;
    left: -220px;
}
#bg1-4 {
    position: absolute;
    top: 220px;
    left: 450px;
}
#bg1-5 {
    position: absolute;
    top: 140px;
    left: 220px;
}

/*animations*/

.cloud {
    background-color: red;
}

              
            
!

JS

              
                $(document).ready(function () {
    var cloud = $('.cloud');

    var cloudTl = new TimelineMax({
        
    });
    cloudTl.to(cloud, 6, {
        left: "100%",
        ease: Linear.easeNone
    }, 0).to(cloud, 10, {
        left: "100%",
        ease: Linear.easeNone
    }, 0).to(cloud, 7, {
        left: "100%",
        ease: Linear.easeNone
    }, 0).to(cloud, 5, {
        left: "100%",
        ease: Linear.easeNone
    }, 0).to(cloud, 8, {
        left: "100%",
        ease: Linear.easeNone
    }, 0);


});

              
            
!
999px

Console