GianlucaGuarini/parallax

View on GitHub
demo/index.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
<head>
  <title>Parallax demo</title>
  <link href='style.css' rel='stylesheet' type='text/css'>
</head>
<body>
  <section class='parallax-container' style='height: 850px;'>
    <img class='parallax' data-center='0.62' data-intensity='20' src='img4.jpg?0' />
    <div class='teaser'>
      <div class='content'>
        <h1>Panorama Image</h1>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
      </div>
    </div>
  </section>
  <section class='parallax-container' style='height: 550px;'>
    <img class='parallax' data-safe-height="0.3"  src='img2.jpg?1' />
    <div class='teaser'>
      <div class='content'>
        <h1>Duis aute</h1>
        <p>Consectetur adipisicing elit, sed do eiusmod
      </div>
    </div>
  </section>
  <section class='parallax-container' style='height: 700px;'>
    <img class='parallax' src='img3.jpg?2' />
    <div class='teaser'>
      <div class='content'>
        <h1>Excepteur sint occaecat</h1>
        <p>Lorem ipsum dolor sit amet
      </div>
    </div>
  </section>

  <section class='parallax-container' style='height: 768px;'>
    <video class="parallax" width='100%' autoplay muted loop>
      <source src='https://interactive-examples.mdn.mozilla.net/media/examples/flower.webm' type='video/webm'>
      <source src='https://interactive-examples.mdn.mozilla.net/media/examples/flower.mp4' type='video/mp4'>
    </video>
  </section>
  <article>
  <h1>Cillum dolore eu fugiat nulla pariatur. </h1>
  <p>Lorem ipsum dolor sit amet,
  consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
  cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
  proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  <h1>Lorem ipsum dolor</h1>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
  tempor incididunt ut labore et dolore magna aliqua. Ut enim ad m
  </article>
  <section class='parallax-container' style='height: 1000px;'>
    <img class='parallax' src='img1.jpg?3' data-intensity='10' />
    <div class='teaser'>
      <div class='content'>
        <h1>Ullamco laboris</h1>
        <p>Excepteur sint occaecat cupidatat
      </div>
    </div>
  </section>
  <h1>Exercitation ullamco laboris nisi</h1>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
  tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
  <h1>Excepteur sint occaecat </h1>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
  tempor incididunt ut labore
  cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
  proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  <footer>
    <h2>Images credits</h2>
    <ul>
      <li><a target='_blank' href='https://www.flickr.com/photos/jal33/15913572056/in/photolist-qfedy1-a9hMHB-9kBbwE-vQokXr-9BrUtY-abYQqH-gq6iN7-dCPEz8-e1LDHU-aWAJHM-bEFMm7-8K64MN-79X24m-6XuBtA-nt82zX-aub7mJ-c6PNJo-9g25DL-gvNaoP-aj4eda-9vNY5B-wza8Jm-rsqByR-ao8s16-hXkR2W-ex69op-5yJEPP-ex6aVa-e4amEd-c29PNq-e4MepZ-nf1k8S-c6b7SA-ctdxyb-9jtgc9-hY5KPW-iqgygN-bD6nKU-7PMSv-n4TrDa-aVg1uF-7VapRN-gb4CYP-fDPnTG-jHMbnB-7nRt5N-bsy8Gh-dMgpoR-9qgjB2-9KB1oa'>img2.jpg</a>
      <li><a target='_blank' href='https://www.flickr.com/photos/gsfc/15107031984/in/photolist-p1XuhG-btu7MA-bGoWje-bbibXF-bGoWnD-a1etXE-rjQRm5-oUvy98-7U17dJ-b8xEnM-7KaLhV-bGoWsk-btu7F1-bK5vji-oUtH6C-bECV2k-ig39ti-92BjRU-nA9o8K-q9KQL6-b8xErF-8xC3dc-bGoWeX-btu7A7-dKM4Fh-9y5sEm-kWbATf-99uoLC-hyzMyT-rPM8pg-bGoW9V-fPHGYz-nC7Cmf-bo7Jxi-pSjnNP-7KeF1y-axyL3u-p5ozBr-9yQ9sq-bo7Ke6-pTPgqf-oStHsL-9ZSYDL-9unbvZ-cbTcEG-jCfMcP-pvyZdV-bnC8bg-9Acdiq-rUQUqF'>img1.jpg</a>
      <li><a target='_blank' href='https://www.flickr.com/photos/gsfc/8371682954/in/photolist-dKM4Fh-9y5sEm-kWbATf-99uoLC-hyzMyT-rPM8pg-bGoW9V-fPHGYz-nC7Cmf-bo7Jxi-pSjnNP-7KeF1y-axyL3u-p5ozBr-9yQ9sq-bo7Ke6-pTPgqf-oStHsL-9ZSYDL-9unbvZ-cbTcEG-jCfMcP-pvyZdV-bnC8bg-9Acdiq-rUQUqF-9pz9YE-pSkF8p-fKURhz-vY58Vs-ue9Y9u-dxe6JK-jCcL4f-a5xj7d-dYwHQz-fF2pnm-gbLNwf-9djPEt-aoTSKK-e7Qukc-c2Xy2E-9S9Wad-axwQBC-8BFiRP-oC2a19-pAPmtA-oC2t8k-aBMrW4-qgKD5W-oC2t1g'>img3.jpg</a>
      <li><a target='_blank' href='https://www.flickr.com/photos/gsfc/5376362076/in/photolist-9c6g8S-dRciBu-9ibWFR-d2H8J3-dxkgAE-nffywb-kW9YmR-7NgSft-7ZLqmc-cc7w2s-dymWmf-dymWpN-aJeJUT-7N6NVg-nwLu8G-7u17Fb-d2H8Aq-eEUScY-nMZDYf-binyhX-qH5nW7-qH5nRY-eyTyM7-ekWFnr-nuGhm7-dQxtZx-q9KPet-qAbfDJ-kwBTxc-5nmCqL-pgG5cx-8Kcfu8-nnQCTx-wed78U-g9iNQK-q7jUq9-dNWFvz-a5xiAA-pMH5pg-eyQoGk-x12YJg-fyF1YU-eENKDp-7DuGyE-7PCURc-yv2isz-7PPtUP-nMSgA2-dAgz3p-nNapsV'>img4.jpg</a>
    </ul>
  </footer>
  <script src='../dist/Parallax.js'></script>
  <script>
    var parallax = new Parallax('.parallax', {})
    parallax.on('element:loaded', function() {
      console.log(arguments)
    })
    parallax.on('elements:loaded', function() {
      console.log(arguments)
    })
    parallax.init()
  </script>
</body>
</html>