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

              
                <!doctype html>
<html class="no-js" lang="">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">


        <script src="js/vendor/modernizr-2.8.3-respond-1.4.2.min.js"></script>
    </head>
    <body>

<!-- HEADER -->
<section>
    <div class="grid-12 trigger1">
        <h2 class="position-h2">The custom OLED displays on iPhone&nbsp;X deliver the most accurate color in the industry, HDR, and true blacks. And iPhone&nbsp;XMax has our largest display ever on an&nbsp;iPhone.</h2>
    </div>
</section>



<section>
    <div class="trigger2">
      <div class="iphone3-text">
          <p>All-screen makes all the difference.</p>
      </div>
        <div class="iphone-image-wrapper">
            <div class="iphone1-text">
                <p>iPhone Xs Max</p>
                <p>6.5" dsiplay</p>
            </div>
            <div class="iphone-image iphone1">
                <div class="inner-phone">
                <img class="iphone1-img" src="https://res.cloudinary.com/dwl9b2qlq/image/upload/v1557828629/img/iphone-1_tmj2v1.png" alt="">
                <img class="iphone-stick" src="https://res.cloudinary.com/dwl9b2qlq/image/upload/v1557828630/img/iphone-3_rprfjz.png" alt="">
                <img class="iphone1-img-behind" src="https://res.cloudinary.com/dwl9b2qlq/image/upload/v1557828632/img/iphone-left_msuiwm.png" alt=""> </div>
            </div>
            <div class="iphone-image iphone2">
                <div class="inner-phone">
                <img class="iphone2-img" src="https://res.cloudinary.com/dwl9b2qlq/image/upload/v1557828629/img/iphone-1_tmj2v1.png" alt="">
                <img class="iphone2-img-behind" src="https://res.cloudinary.com/dwl9b2qlq/image/upload/v1557828630/img/iphone-right_xizcmi.png" alt="">
                </div>
            </div>
            <div class="iphone2-text">
                <p>iPhone Xs Max</p>
                <p>5.8" display</p>
            </div>
        </div>
    </div>
</section>





<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/TweenMax.min.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.6/ScrollMagic.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.6/plugins/animation.gsap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.6/plugins/debug.addIndicators.min.js"></script>

        <script src="js/main.js"></script>
    </body>
</html>

              
            
!

CSS

              
                * {
    box-sizing: border-box;
}

body {
    background: #000;
}

section {
    position: relative;
    height: 100vh;
    width: 100vw;
}

h2 {
    font-size: 50px;
    font-family: "SF Pro Display","SF Pro Icons","Helvetica Neue","Helvetica","Arial",sans-serif;
    font-weight: 500;
    color: #ffe5db;
}

.grid-12 {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(12, 1fr);
}

.position-h2 {
    grid-row: 7;
    grid-column: 5 / span 4;
    align-self: center;
}

.iphone-image-wrapper {
    height: 100vh;
    width: 100%;
    justify-content: center;
    display: grid;
    grid-auto-columns: 2fr 1fr 2fr;
    grid-template-rows: repeat(1, 1fr);
    align-items: center;
}

.iphone-image {
    grid-row: 1;
    grid-column: 2 / span 1;
    align-self: center;
    justify-self:center;
    text-align: center;
    max-width: 100%;
}

.inner-phone {
    position: relative;
}


p {
    color: #FFF;
    font-weight: 600;
    font-size: 20px;
    margin:0 0 8px 0;
}

.iphone1-text {
    grid-column: 1;
    text-align: right;
}

.iphone2-text {
    grid-column: 3;
}

.iphone3-text {
    grid-column: 3;
    text-align: center;
}

.iphone1-img {
 position: absolute;
    z-index: 2;
}

.iphone-stick {
    display: none;
     position: absolute;
    left: 54.5%;
}

.iphone2-img {
 position: absolute;
    z-index: 2;
}

.iphone1 img {
    width: 100%;
}

.iphone2 img {
    width: 88%;
}

.iphone1-img-behind {
    z-index: 1;
    position: relative;
}

.iphone2-img-behind {
    z-index: 1;
    position: relative;
}



/* Here we go to next phase

              
            
!

JS

              
                var tlFirstScroll = new TimelineMax ();

tlFirstScroll
.set ('.iphone-image-wrapper', {scale: 4, transformOrigin:"center top"})
.to ('.iphone-image-wrapper', 3, {scale: 2, y: "-50%"})
.to ('.iphone-image-wrapper', 3, {scale: 1, y: "0%"})


var controller = new ScrollMagic.Controller ();

//scene1

var scene1 = new ScrollMagic.Scene ({
  triggerElement: '.trigger1',
  triggerHook: 0,
  duration: "100%"
})

.setTween (tlFirstScroll)
.addIndicators()
.addTo(controller);

var tlSecondScrol = new TimelineMax ();

tlSecondScrol
.to ('.iphone1', 3, {x: "-54%"})
.to ('.iphone2', 3, {x: "54%"}, "-=3")
.from ('.iphone1-text', 0.3, {autoAlpha: 0}, "-=3")
.from ('.iphone2-text', 0.3, {autoAlpha: 0}, "-=3")
.to ('.iphone1-text', 3, {x: "-30%"}, "-=3")
.to ('.iphone2-text', 3, {x: "30%"}, "-=3")

.set ('.iphone-stick', {display: "block"})

.to ('.iphone1-img-behind', 3, {x: "-50%", ease:Power4.easeOut})
.to ('.iphone2-img-behind', 3, {x: "50%", ease:Power4.easeOut}, "-=3")
.from ('.iphone3-text', 3, {autoAlpha: 0}, "-=3")

.to ('.iphone1-img', 0.5, {autoAlpha: 0}, "-=3")
.to ('.iphone2-img', 0.5, {autoAlpha: 0}, "-=3")

.to ('.iphone1-text', 0.3, {autoAlpha: 0}, "-=3")
.to ('.iphone2-text', 0.3, {autoAlpha: 0}, "-=3")

/*
var tl = new TimelineLite();
  // declare tween animations
  tl.to(".iphone2-img-behind", 1, {x:-300})
    .to(".iphone1-img-behind", 1, {x:300}, "-=1");
*/

var scene2 = new ScrollMagic.Scene ({
  triggerElement: '.trigger2',
  triggerHook: 0,
  duration: "100%"
})

.setTween (tlSecondScrol)
.setPin ('.trigger2')
.addIndicators()
.addTo(controller);

              
            
!
999px

Console