|File Size:||9.81 KB|
|Official Website:||Go to website|
saparallax.js is a lightweight jQuery plugin that adds the familiar parallax effect on any DOM elements when scroll down the webpage. Works on both absolutely and relatively positioned elements. Heavily based on CSS3 3D transforms.
# NPM $ npm install saparallax --save # Bower $ bower install saparallax
How to use it:
1. First you need to load the saparallax.js script after you've loaded the latest version of jQuery.
<script src="//code.jquery.com/jquery.min.js"></script> <script src="scripts/saparallax.js"></script>
2. Add the 'data-sabglayer' attribute to any parallax element like this:
<img data-sabglayer src="1.jpg">
3. By giving a value to the 'data-sabglayer' attribute, you can control the scroll speed of the elements. Enter a number from 0 (same as foreground) to 2 (will appear static).
- JS updated
- always center the to-be-parallaxed element