data-depth
attributes, and initialize Parallax in the footer using JavaScript targeting the container ID.To create parallax elements in Webflow using Matthew Wagerfield's Parallax.js, you'll need to integrate the provided JavaScript library properly and set up the elements in Webflow to respond to it.
Go to Project Settings > Custom Code > Head Code.
Add this line inside the head tag to include the script:
<script src="https://cdnjs.cloudflare.com/ajax/libs/parallax/3.1.0/parallax.min.js"></script>
Alternatively, if Matthew’s official website provides a direct script URL, you can use that instead.
Save changes and publish your project.
Create a parent div (e.g., “parallax-container”) and give it a unique ID (parallax-scene
).
Add multiple child elements (like images, divs, or SVGs) inside this container. They will move at different speeds.
Each child needs a custom attribute:
Click on a child element > Settings Tab > Custom Attributes
Add: Name: data-depth
, Value: a decimal like 0.2
, 0.6
, or 1.0
(higher = faster movement)
Go to Page Settings > Footer Code (Before
tag)
Add this custom script:
<script>var scene = document.getElementById('parallax-scene'); var parallaxInstance = new Parallax(scene);</script>
This script activates Parallax.js on the container with ID parallax-scene
.
To use Parallax.js in Webflow, load the script via the project’s head code, structure elements with data-depth
attributes inside a scene container, and initialize the effect with a script in the footer. The parallax will work based on mouse movement on the published site.