
Directly on image tags
The effect applies to the img itself. Any image works, including the next/image component.
A lightweight React component and JavaScript library that adds a parallax effect straight on your image tags. No background images, and it works with next/image.
$ npm i simple-parallax-js
The effect applies to the img itself. Any image works, including the next/image component.
Wrap an image in a React component, or use the vanilla build with simple-parallax-js/vanilla.
Change direction, scale, delay, transition, overflow or maxTransition only when you need to.
simpleParallax.js is an open-source parallax library for React, Next.js and vanilla JavaScript. It adds a scroll-driven parallax effect directly to your img tags, with no background images needed. It is published on npm as simple-parallax-js under the MIT license.
It started as a jQuery plugin, became a vanilla JavaScript library, and is now built for React, with the vanilla build still available.
Figures from the npm registry and GitHub, checked on November 16, 2026.
Install the package with your favorite package manager, then import it for React or for vanilla JavaScript.
npm install simple-parallax-jsyarn add simple-parallax-jsbun add simple-parallax-jsimport SimpleParallax from "simple-parallax-js";import SimpleParallax from "simple-parallax-js/vanilla";Simply add the following JavaScript code. In vanilla JS, you can also apply the parallax to several images at once.
import SimpleParallax from "simple-parallax-js";
const Component = () => (
<SimpleParallax>
<img src="image.jpg" alt="image" />
</SimpleParallax>
)"use client";
import SimpleParallax from "simple-parallax-js";
import Image from "next/image";
const Component = () => (
<SimpleParallax>
<Image src="/image.jpg" alt="image" width={1024} height={1920} />
</SimpleParallax>
)var image = document.getElementsByClassName('thumbnail');
new SimpleParallax(image);
// You can also choose to apply the parallax on multiple images:
var images = document.querySelectorAll('img');
new SimpleParallax(images);hint: up - right - down - left - up left - up right - down left - down right
This is the orientation (or direction) of the parallax effect. Choose up and when scrolling down, the image will translate from the bottom to the top (so the image will translate up). When scrolling up, the image will translate from the top to the bottom. Same logic applies for all other orientations (right, down, left, up left, up right, down left, or down right). When 2 directions are combined (for example down right), the image will translate diagonally.
See example →hint: need to be above 1.0
The higher the scale is set, the more visible the parallax effect will be. In return, the image will lose in quality. To reduce the lossless effect, if the scale is set at 1.5 and your image is 500px width, do the simple math 500 * 1.5 = 750. So you can choose a 750px image to replace your 500px one and don't see any quality leak.
See example →By default, the image is scaled to apply a parallax effect without any overflow on the layout. When overflow is set to true, the image will translate out of its natural flow (so it may overlap with your content).
See example →hint: the delay is in second
When a delay is set, the translation of the image will continue during that delay when the user stops scrolling. That gives a very nice effect. The delay is in second.
See example →hint: any CSS transition
The transition setting works closely with the delay setting. This setting will add any CSS transition to the delay setting. For example, you can use ease or ease-in-out.
See example →hint: it should be a percentage between 1 and 99
The maxTransition setting should be used to stop the parallax animation after a given percentage. By default, it translates from 0% to 100% of the user viewport. You can change it here to any percentage you want.
See example →By default, the parallax calculation is done with the body scroll percentage. In some cases, the images may be in a container that has its own scroll area, so to have an accurate calculation, the custom container should be set.
In some cases, you want to use your own wrapper instead of the one created by the plugin. If you specify your custom wrapper, the plugin will add the simpleParallax class along with an overflow: hidden style.
Refresh a simpleParallax instance, to recalculate all the positions.
var images = document.querySelectorAll('img');
var instance = new SimpleParallax(images);
instance.refresh();Destroy a simpleParallax instance.
var images = document.querySelectorAll('img');
var instance = new SimpleParallax(images);
instance.destroy();Six live previews, one per setting. Each one is the exact code shown below it.
import SimpleParallax from "simple-parallax-js";
const Component = () => (
<SimpleParallax>
<img src={"thumbnail.jpg"} alt={"image"} />
</SimpleParallax>
)"use client";
import SimpleParallax from "simple-parallax-js";
import Image from "next/image";
const Component = () => (
<SimpleParallax>
<Image src={"/thumbnail.jpg"} alt={"image"} width={768} height={430} />
</SimpleParallax>
)import SimpleParallax from "simple-parallax-js/vanilla";
var image = document.getElementsByClassName('thumbnail');
new SimpleParallax(image);import SimpleParallax from "simple-parallax-js";
const Component = () => (
<SimpleParallax orientation="right">
<img src={"thumbnail.jpg"} alt={"image"} />
</SimpleParallax>
)"use client";
import SimpleParallax from "simple-parallax-js";
import Image from "next/image";
const Component = () => (
<SimpleParallax orientation="right">
<Image src={"/thumbnail.jpg"} alt={"image"} width={768} height={430} />
</SimpleParallax>
)import SimpleParallax from "simple-parallax-js/vanilla";
var image = document.getElementsByClassName('thumbnail');
new SimpleParallax(image, {
orientation: 'right'
});import SimpleParallax from "simple-parallax-js";
const Component = () => (
<SimpleParallax scale={1.7}>
<img src={"thumbnail.jpg"} alt={"image"} />
</SimpleParallax>
)"use client";
import SimpleParallax from "simple-parallax-js";
import Image from "next/image";
const Component = () => (
<SimpleParallax scale={1.7}>
<Image src={"/thumbnail.jpg"} alt={"image"} width={768} height={430} />
</SimpleParallax>
)import SimpleParallax from "simple-parallax-js/vanilla";
var image = document.getElementsByClassName('thumbnail');
new SimpleParallax(image, {
scale: 1.7
});
The dashed green outline is only an illustration: it shows the image's original box and is not part of the effect.
import SimpleParallax from "simple-parallax-js";
const Component = () => (
<SimpleParallax overflow orientation="right">
<img src={"thumbnail.jpg"} alt={"image"} />
</SimpleParallax>
)"use client";
import SimpleParallax from "simple-parallax-js";
import Image from "next/image";
const Component = () => (
<SimpleParallax overflow orientation="right">
<Image src={"/thumbnail.jpg"} alt={"image"} width={768} height={430} />
</SimpleParallax>
)import SimpleParallax from "simple-parallax-js/vanilla";
var image = document.getElementsByClassName('thumbnail');
new SimpleParallax(image, {
overflow: true,
orientation: 'right'
});import SimpleParallax from "simple-parallax-js";
const Component = () => (
<SimpleParallax delay={1} scale={1.5} transition="cubic-bezier(0,0,0,1)">
<img src={"thumbnail.jpg"} alt={"image"} />
</SimpleParallax>
)"use client";
import SimpleParallax from "simple-parallax-js";
import Image from "next/image";
const Component = () => (
<SimpleParallax delay={1} scale={1.5} transition="cubic-bezier(0,0,0,1)">
<Image src={"/thumbnail.jpg"} alt={"image"} width={768} height={430} />
</SimpleParallax>
)import SimpleParallax from "simple-parallax-js/vanilla";
var image = document.getElementsByClassName('thumbnail');
new SimpleParallax(image, {
delay: 1,
scale: 1.5,
transition: 'cubic-bezier(0,0,0,1)'
});import SimpleParallax from "simple-parallax-js";
const Component = () => (
<SimpleParallax maxTransition={60}>
<img src={"thumbnail.jpg"} alt={"image"} />
</SimpleParallax>
)"use client";
import SimpleParallax from "simple-parallax-js";
import Image from "next/image";
const Component = () => (
<SimpleParallax maxTransition={60}>
<Image src={"/thumbnail.jpg"} alt={"image"} width={768} height={430} />
</SimpleParallax>
)import SimpleParallax from "simple-parallax-js/vanilla";
var image = document.getElementsByClassName('thumbnail');
new SimpleParallax(image, {
maxTransition: 60
});Install simple-parallax-js, import SimpleParallax and wrap your img in it: <SimpleParallax><img src="image.jpg" alt="image" /></SimpleParallax>. The parallax applies directly to the image tag, so you need no background images and no extra CSS.
Yes. Wrap the next/image Image component in SimpleParallax, exactly as you would a plain img. In the App Router, use it inside a Client Component with the "use client" directive.
Yes. Import the vanilla build from simple-parallax-js/vanilla, or use the SimpleParallax global, then call new SimpleParallax(images) on one or several img elements. The vanilla version also offers the refresh() and destroy() methods.
Not by default. The image is scaled inside its wrapper, so the effect never overflows your layout. Set overflow to true if you want the image to translate outside its natural flow and overlap your content.
Use the settings: orientation (up, down, left, right or a diagonal), scale for the intensity, delay and transition for the easing, and maxTransition to stop the effect after a percentage of the viewport. Try them in the playground above.
No. simpleParallax.js is built for img tags, so use an img with object-fit: cover instead of a CSS background-image. It keeps your image accessible with alt text and compatible with next/image.
It is free and open source under the MIT license. The npm package includes TypeScript type declarations for the React build.
If you like simpleParallax.js, please consider supporting the project by giving it a star on GitHub.