<!DOCTYPE html>
<html lang="en" class="animated fadeIn">

<head>
  <meta charset="UTF-8">
  <title>Multi-layered Parallax Illustration </title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
<link href='https://fonts.googleapis.com/css?family=Playfair+Display' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">

  <link rel='stylesheet' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
<link rel='stylesheet' href='http://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.3/animate.min.css'>

      <link rel="stylesheet" href="css/style.css">


</head>

<body>
<section>
  <div class="full-height">
    <div class="pin-scene">
  <div id='hero'>
  <div class='layer-bg layer' data-depth='0.10' data-type='parallax'></div>
  <div class='layer-1 layer' data-depth='0.20' data-type='parallax'></div>
  <div class='layer-2 layer' data-depth='0.50' data-type='parallax'></div>
  <div class='layer-3 layer' data-depth='0.80' data-type='parallax'></div>
<!--  <div class='layer-overlay layer' data-depth='0.85' data-type='parallax'></div>-->
  <div class='layer-4 layer' data-depth='1.00' data-type='parallax'></div>
  <div class='layer-5 layer' data-depth='1.00' data-type='parallax'></div>
  <div class='layer-6 layer' data-depth='1.00' data-type='parallax'></div>
  <div class='layer-7 layer' data-depth='1.00' data-type='parallax'></div>
  <div class='layer-8 layer' data-depth='1.00' data-type='parallax'></div>
</div>
</div>
</div>

<div id='hero-mobile'></div>
</section>



<section>
  <div class="section2 full-height">

<div id='content'>
  <div class='container'>
    <section class='first-section'>
      <div class='row'>
        <div class='col-sm-6'>
          <h1>You cannot hide the soul. Through all his unearthly tattooings, I thought I saw the traces of a simple honest heart.</h1>
        </div>
      </div>
      <div class='row'>
        <div class='col-sm-6'>
          <p>And besides all this, there was a certain lofty bearing about the Pagan, which even his uncouthness could not altogether maim. He looked like a man who had never cringed and never had had a creditor. Whether it was, too, that his head being shaved, his forehead was drawn out in freer and brighter relief, and looked more expansive than it otherwise would, this I will not venture to decide; but certain it was his head was phrenologically an excellent one.</p>
          <p>It may seem ridiculous, but it reminded me of General Washington's head, as seen in the popular busts of him. It had the same long regularly graded retreating slope from above the brows, which were likewise very projecting, like two long promontories thickly wooded on top. Queequeg was George Washington cannibalistically developed.</p>
          <p>Whilst I was thus closely scanning him, half-pretending meanwhile to be looking out at the storm from the casement, he never heeded my presence, never troubled himself with so much as a single glance; but appeared wholly occupied with counting the pages of the marvellous book. Considering how sociably we had been sleeping together the night previous, and especially considering the affectionate arm I had found thrown over me upon waking in the morning, I thought this indifference of his very strange. But savages are strange beings; at times you do not know exactly how to take them.</p>
        </div>
        <div class='col-sm-6'>
          <p>At first they are overawing; their calm self-collectedness of simplicity seems a Socratic wisdom. I had noticed also that Queequeg never consorted at all, or but very little, with the other seamen in the inn. He made no advances whatever; appeared to have no desire to enlarge the circle of his acquaintances. All this struck me as mighty singular; yet, upon second thoughts, there was something almost sublime in it. Here was a man some twenty thousand miles from home, by the way of Cape Horn, that is—which was the only way he could get there—thrown among people as strange to him as though he were in the planet Jupiter; and yet he seemed entirely at his ease; preserving the utmost serenity; content with his own companionship; always equal to himself.</p>
          <p>Here was a man some twenty thousand miles from home, by the way of Cape Horn, that is—which was the only way he could get there—thrown among people as strange to him as though he were in the planet Jupiter; and yet he seemed entirely at his ease; preserving the utmost serenity; content with his own companionship; always equal to himself. Surely this was a touch of fine philosophy; though no doubt he had never heard there was such a thing as that.</p>
          <a class='tutorial-link' href='https://medium.com/@PatrykZabielski/how-to-make-multi-layered-parallax-illustration-with-css-javascript-2b56883c3f27'>
            Learn how to create this parallax effect
          </a>
        </div>
      </div>
    </section>
  </div>
</div>
</div>
</section>

<script type="text/javascript" src="js/jquery.mousewheel.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.2/TweenMax.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.6/ScrollMagic.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.6/plugins/animation.gsap.js"></script>

    <script  src="js/index.js"></script>




</body>

</html>
.full-height {
  height: 100vh;
  width: 100%;
  position: relative;
}

body {
  padding: 0;
  margin: 0;
  background-color: #130d0a;
  font-family: 'Playfair Display', serif;
  color: #fff;
}

#hero {
  height: 100vh;
  overflow: hidden;
  position: relative;
}

#hero, .layer {
  min-height: 100vh;
}

#content {
  background-color: #031b1a;
}

.layer {
  background-position: bottom center;
  background-size: auto;
  background-repeat: no-repeat;
  width: 100%;
  height: 100vh;
  position: fixed;
  z-index: -1;
}

#hero-mobile {
  display: none;
  background: url("../img/") no-repeat center bottom/cover;
  height: 320px;
}

.first-section {
  padding: 50px 0 20px 0;
}

.text-header {
  font-size: 50px;
  text-align: center;
}

h1 {
  line-height: 120%;
  margin-bottom: 30px;
}

p {
  color: #ede0d5;
  font-size: 18px;
  line-height: 150%;
}



.layer-bg {
  background-image: url("../img/main-slidersky.png");
  background-size: cover;
}

.layer-1 {
  background-image: url("../img/main-slidermountain.png");
  background-position: left bottom;
    /*position: fixed;*/
    bottom: 20%;
    left: -10%;
    background-size: 70%;
  z-index:1;
}

.layer-2 {
  background-image: url("../img/main-sliderPines-1.png");
      background-size: 110%;
  z-index:2;

}

.layer-3 {
  background-image: url("../img/main-sliderPines-2.png");
  background-size: 110%;
  bottom: -30%;
  /*background-position: right bottom;*/
  z-index:3;
  overflow:hidden;
}

.layer-4 {
  background-image: url("../img/main-sliderPines-3.png");
  background-size: 110%;
  bottom: -30%;
  z-index:4;
}

.layer-5 {
  background-image: url("../img/main-sliderPines-4.png");
  background-size: 110%;
  bottom: -70%;
  z-index:5;
}

.layer-6 {
  background-image: url("../img/main-sliderPines-5.png");
  background-size: 110%;
  bottom: -70%;
  z-index:6;
}

.layer-7 {
  background-image: url("../img/main-sliderPines-6.png");
  background-size: 110%;
  bottom: -120%;
  z-index:7;
}

.layer-8 {
  background-image: url("../img/");
}

.layer-overlay {
  background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/272781/ilu_overlay.png");
}

@media only screen and (max-width: 768px) {
  #hero {
    display: none;
  }

  #hero-mobile {
    display: block;
  }
}
.tutorial-link {
  color: #fff;
  font-size: 18px;
  text-decoration: underline;
}
.tutorial-link:hover {
  color: #ede0d5;
}
jQuery(document).ready(function($) {

  var bgImage =$(".bg-image"),
      layer1 =$(".layer-1"),
      layer2 =$(".layer-2"),
      layer3 =$(".layer-3"),
      layer4 =$(".layer-4"),
      layer5 =$(".layer-5"),
      layer6 =$(".layer-6"),
      layer7 =$(".layer-7"),
      layer8 =$(".layer-8")

  /*    // Animate in

      var tlLoader = new TimelineMax();
       tlLoader
       .from(titleMain, 2,{autoAlpha:0})
       .from(scrollLine, 0.5,{scaleY:0, transformOrigin:"center top", ease:Power1.easeOut}, '-=2')
       .from(bgImage, 2, {autoAlpha:0, scale: 1.5,ease:Power1.easeOut}, '-=2')
       .from(dude, 2, {autoAlpha: 0, scale: 1.5, ease:Power1.easeOut},'-=1.5')*/

       //Scroll Starts

       var controller = new ScrollMagic.Controller();

       var tlMainScroll = new TimelineMax()
       .add([

      /* //OLD CODE

       //TweenMax.to(layer2, 1, {autoAlpha:0}),
        //TweenMax.to(dude, 4, {scale:2, y: 150, x:"-45%", ease:Power1.easeInOut}),
          TweenMax.to(layer1, 4, {scale:2, y:"50%", ease:Power1.easeInOut},'=20'),
          TweenMax.to(layer2, 4, {scale:2, y:"-250%", ease:Power1.easeInOut}),
          TweenMax.to(layer3, 4, {scale:2, y:"-300%", ease:Power1.easeInOut}),
          TweenMax.to(layer4, 4, {scale:2, y:"-350%", ease:Power1.easeInOut}),
          TweenMax.to(layer5, 4, {scale:2, y:"-400%", ease:Power1.easeInOut}),
          TweenMax.to(layer6, 4, {scale:2, y:"-450%", ease:Power1.easeInOut}),
          TweenMax.to(layer7, 4, {scale:2, y:"-500%", ease:Power1.easeInOut}),
          TweenMax.to(layer8, 4, {scale:2, y:"-180%", ease:Power1.easeInOut}),
          TweenMax.to(bgImage, 4, {scale:1, ease:Power1.easeInOut}),
*/

          TweenMax.to(layer1, 5, {y:'+=50'},0),
          TweenMax.to(layer2, 5, {y:'-=400'},0),
          TweenMax.to(layer3, 4, {y:'-=500'},0),
          TweenMax.to(layer4, 4, {y:'-=600'},0),
          TweenMax.to(layer5, 4, {y:'-=1100'},0),
          TweenMax.to(layer6, 4, {y:'-=1400'},0),
          TweenMax.to(layer7, 4, {y:'-=1800'},0),
          TweenMax.to(layer8, 4, {y:'+=300'},0),
          TweenMax.to(bgImage, 4, {scale:1, ease:Power1.easeInOut}),
       ]);

       //Pin the scene
       var tweenHome = new ScrollMagic.Scene({
           triggerElement: '.pin-scene',
           triggerHook:0,
           duration: '300%'})

       .setTween(tlMainScroll)
       .setPin('.pin-scene')
       .addTo(controller);

       //Scroll Out

       var tlMainScrollOut = new TimelineMax()
           .add([
               TweenMax.from('.section2', 1, {autoAlpha:0}),
               TweenMax.to(bgImage, 8, {autoAlpha:0}),
               TweenMax.to(layer1, 8, {autoAlpha:0}),
               TweenMax.to(layer2, 8, {autoAlpha:0}),
               TweenMax.to(layer3, 8, {autoAlpha:0}),
               TweenMax.to(layer4, 8, {autoAlpha:0}),
               TweenMax.to(layer5, 8, {autoAlpha:0}),
               TweenMax.to(layer6, 8, {autoAlpha:0}),
               TweenMax.to(layer7, 8, {autoAlpha:0}),
               TweenMax.to(layer8, 8, {autoAlpha:0}),
           ]);

       var section2 = new ScrollMagic.Scene ({
           triggerElement: '.section2',
           triggerHook: 0,
           duration: '200%'})
       .setTween(tlMainScrollOut)
       .setPin('.section2')
       .addTo(controller);

});



/*

(function() {
  // Tutorial: https://medium.com/@PatrykZabielski/how-to-make-multi-layered-parallax-illustration-with-css-javascript-2b56883c3f27
  window.addEventListener('scroll', function(event) {
    var depth, i, layer, layers, len, movement, topDistance, translate3d;
    topDistance = this.pageYOffset;
    layers = document.querySelectorAll("[data-type='parallax']");
    for (i = 0, len = layers.length; i < len; i++) {
      layer = layers[i];
      depth = layer.getAttribute('data-depth');
      movement = -(topDistance * depth);
      translate3d = 'translate3d(0, ' + movement + 'px, 0)';
      layer.style['-webkit-transform'] = translate3d;
      layer.style['-moz-transform'] = translate3d;
      layer.style['-ms-transform'] = translate3d;
      layer.style['-o-transform'] = translate3d;
      layer.style.transform = translate3d;
    }
  });

}).call(this);


*/

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiPGFub255bW91cz4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7RUFBQTtFQUVBLE1BQU0sQ0FBQyxnQkFBUCxDQUF3QixRQUF4QixFQUFrQyxRQUFBLENBQUMsS0FBRCxDQUFBO0FBQ2hDLFFBQUEsS0FBQSxFQUFBLENBQUEsRUFBQSxLQUFBLEVBQUEsTUFBQSxFQUFBLEdBQUEsRUFBQSxRQUFBLEVBQUEsV0FBQSxFQUFBO0lBQUEsV0FBQSxHQUFjLElBQUMsQ0FBQTtJQUNmLE1BQUEsR0FBUyxRQUFRLENBQUMsZ0JBQVQsQ0FBMEIsd0JBQTFCO0lBRVQsS0FBQSx3Q0FBQTs7TUFDRSxLQUFBLEdBQVEsS0FBSyxDQUFDLFlBQU4sQ0FBbUIsWUFBbkI7TUFDUixRQUFBLEdBQVcsQ0FBQyxDQUFDLFdBQUEsR0FBYyxLQUFmO01BQ1osV0FBQSxHQUFjLGlCQUFBLEdBQW9CLFFBQXBCLEdBQStCO01BQzdDLEtBQUssQ0FBQyxLQUFNLENBQUEsbUJBQUEsQ0FBWixHQUFtQztNQUNuQyxLQUFLLENBQUMsS0FBTSxDQUFBLGdCQUFBLENBQVosR0FBZ0M7TUFDaEMsS0FBSyxDQUFDLEtBQU0sQ0FBQSxlQUFBLENBQVosR0FBK0I7TUFDL0IsS0FBSyxDQUFDLEtBQU0sQ0FBQSxjQUF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en doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.