paroller.js is a lightweight jQuery plugin that enables parallax scrolling effect on selected elements.
Before closing </body>
element include:
<script src="jquery-3.1.1.min.js"></script>
<script src="jquery.paroller.min.js"></script>
// initialize paroller.js
$('.my-paroller').paroller();
// initialize paroller.js and set attributes
$("#my-element").paroller({ factor: '0.5', type: 'foreground', direction: 'horizontal' });
// define element
<div class="my-paroller" data-paroller-factor="0.3" data-paroller-type="foreground" data-paroller-direction="horizontal"></div>
<div id="my-element"></div>
$ npm install paroller.js
require('paroller.js');
$ bower install paroller.js
$ yarn add paroller.js
To use paroller.js parallax scrolling effect you can use data-paroller-* attributes on selected elements or set values via jQuery. 'factor' sets speed and distance of element's parallax effect on scroll.
<div class="paroller"> Awesome element with parallax effect </div> // initialize paroller.js and set attributes for selected elements $(".paroller, [data-paroller-factor]").paroller({ factor: 0.3, // multiplier for scrolling speed and offset type: 'foreground', // background, foreground direction: 'horizontal' // vertical, horizontal });
<div data-paroller-factor="-0.1" data-paroller-type="foreground" data-paroller-direction="vertical"> Awesome element with parallax effect </div> // initialize paroller.js $("[data-paroller-factor]").paroller();
<div data-paroller-factor="0.3"></div>
<div data-paroller-factor="0.3" data-paroller-type="foreground"></div>
<div data-paroller-factor="0.3" data-paroller-direction="horizontal"></div>
// initialize paroller.js and set attributes for selected elements $(".paroller, [data-paroller-factor]").paroller({ factor: 0.3, // multiplier for scrolling speed and offset type: 'foreground', // background, foreground direction: 'horizontal' // vertical, horizontal });
data-paroller-factor="0.5"
data-paroller-factor="-0.15"
$('.paroller').paroller({
factor: 0.4,
type: 'foreground'
});
data-paroller-factor="0.1" data-paroller-type="foreground"
data-paroller-factor="-0.4" data-paroller-type="foreground"
data-paroller-factor="0.9" data-paroller-type="foreground"
data-paroller-direction="vertical"
data-paroller-factor="0.15" data-paroller-type="foreground"
data-paroller-direction="vertical"
data-paroller-factor="-0.1" data-paroller-type="foreground"
data-paroller-direction="vertical"
data-paroller-factor="0.5"
data-paroller-factor="-0.75"
data-paroller-factor="-0.3" data-paroller-type="foreground"
data-paroller-direction="horizontal"
data-paroller-factor="-0.1" data-paroller-type="foreground"
data-paroller-direction="horizontal"
data-paroller-factor="0.1" data-paroller-type="foreground"
data-paroller-direction="horizontal"