Slider parallax animations

Some slider components have an animation which reacts when the user move the cursor of the mouse. The plugin behind the animation is called parallax-js and is located in  app/vendors/parallax-js folder.

This is how a slider item looks like with the necessary id, classes and attributes which are selected in the image below:

To kickoff a Parallax scene, select your parent DOM Element and pass it to the Parallax constructor.

var scene = document.getElementById('scene')
// or, if you use jQuery
var scene = $('#scene').get(0)

var parallax = new Parallax(scene)

In order to perform the animation, you will need to add an id called “scene” on the parent div where you want to apply the animation, then you will need to use the “layer” class preceded by the “data-depth” attribute which can contain a value from 0 to 1. This value reflect the element motion from your animation.

A depth of 0 will cause the layer to remain stationary, and a depth of 1 will cause the layer to move by the total effect of the calculated motion.

You can find more about this on: https://github.com/wagerfield/parallax