<script src="https://cdnjs.cloudflare.com/ajax/libs/parallax/3.1.0/parallax.min.js"></script>

<div id="scene" class="container">
  <div data-depth="0.5" id="fg" class="item"></div>
  <div data-depth="0.2  " id="bg" class="item"></div>
</div>
$red: #ff3535;
$green: #82ff44;

#fg {
  height: 100px;
  width: 100px;
  background-color: $red;
  z-index: 1;
}

#bg {
  height: 200px;
  width: 200px;
  background-color: $green;
  z-index: 0;
}

.container {
  position: relative;
}

.item {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
View Compiled
var scene = document.getElementById('scene');
var parallaxInstance = new Parallax(scene);

// allows for limiting x or y axis parallaxing
parallaxInstance.limit(false, false);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.