Parallax
Around supports 2 types of parallax effect: on page scrolling and cursor position.
In your document make sure to link to:
- vendor/jarallax/dist/jarallax.min.js - for background image parallax
- vendor/jarallax/dist/jarallax-element.min.js - for element parallax
- vendor/parallax-js/dist/parallax.min.js - for cursor position parallax
Use this page as a reference.
Background image
Lorem ipsum dolor sit amet, consectetur adipiscing 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 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.
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat.
Lorem ipsum dolor sit amet, consectetur adipiscing 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 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.
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat.
<!-- Background image parallax -->
<div class="jarallax bg-dark py-7" data-jarallax data-speed="0.3">
<span class="bg-overlay" style="opacity: .35;"></span>
<div class="jarallax-img" style="background-image: url(path-to-background-image);"></div>
<div class="container bg-overlay-content py-5 py-sm-7 text-center">
<h2 class="h1 text-light mb-0">Parallax backgound image</h2>
</div>
</div>
// Background image parallax
.jarallax.bg-dark.py-7(data-jarallax data-speed="0.3")
span.bg-overlay(style="opacity: .35;")
.jarallax-img(style="background-image: url(path-to-background-image);")
.container.bg-overlay-content.py-5.py-sm-7.text-center
h2.h1.text-light.mb-0 Parallax backgound image
Element parallax
<!-- Element parallax -->
<div class="d-flex">
<div data-jarallax-element="40">
<img src="path-to-image" alt="Alt text">
</div>
<div data-jarallax-element="-40">
<img src="path-to-image" alt="Alt text">
</div>
</div>
// Element parallax
.d-flex
div(data-jarallax-element="40")
+image("path-to-image", "Alt text")
div(data-jarallax-element="-40")
+image("path-to-image", "Alt text")
Cursor position parallax
<!-- Cursor position parallax -->
<div class="cs-parallax">
<div class="cs-parallax-layer position-relative" data-depth="0.1">
<img src="path-to-image" alt="Layer">
</div>
<div class="cs-parallax-layer position-relative" data-depth="0.35">
<img src="path-to-image" alt="Layer">
</div>
<div class="cs-parallax-layer position-relative" data-depth="0.2">
<img src="path-to-image" alt="Layer">
</div>
<!-- Add as many layers as you need with different data-depth parameters for more 3D-like effect. Make sure add position-relative to biggest layer to keep width and height. -->
</div>
// Cursor position parallax
.cs-parallax
.cs-parallax-layer.position-relative(data-depth="0.1")
+image("path-to-image", "Layer")
.cs-parallax-layer(data-depth="0.35")
+image("path-to-image", "Layer")
.cs-parallax-layer(data-depth="0.2")
+image("path-to-image", "Layer")
//- Add as many layers as you need with different data-depth parameters for more 3D-like effect. Make sure add position-relative to biggest layer to keep width and height.