simpleParallax.js is a free, open source design & prototyping project written in TypeScript and released under MIT. It has 2,159 GitHub stars, 146 forks and 0 open issues, and was last pushed 6 days ago. On this registry it ranks #79 of 127 tracked projects in Design & Prototyping, with 5 head-to-head comparisons available.

What is simpleParallax.js?

simpleParallax.js is a lightweight, MIT-licensed TypeScript library published on npm as simple-parallax-js that adds a parallax effect directly to `` tags in React, Next.js, and vanilla JavaScript projects, aimed at front-end developers and designers who want a scroll effect without writing or configuring a complex plugin.

What it is

simpleParallax.js is a small front-end library with two entry points: a React component imported from simple-parallax-js and a vanilla JavaScript version imported from simple-parallax-js/vanilla. The package is written in TypeScript and ships type definitions for both entry points, so no separate @types package is needed. It is designed to work out of the box with React, Next.js, and plain JavaScript, and its published topics place it among animation, image, parallax, and scroll tools.

The problem it solves is specific: parallax effects are usually built by swapping in background images and animating their position, or by adopting a plugin that the README describes as complex. simpleParallax.js applies the movement directly to the `` tags a page already has, with no background images required, so any existing image can be used as-is. Initialization is a single constructor call in vanilla JavaScript, and the effect can be attached to one image or to a whole collection returned by querySelectorAll or getElementsByClassName.

Key capabilities

  • Applies the parallax effect to existing `` tags rather than background images, through either the React component or new SimpleParallax(images).
  • Exposes an orientation setting covering up, right, down, left, and the four diagonal combinations such as up left and down right.
  • Provides a scale setting that must be above a value of 1, with a default of 1.5.
  • Offers a delay setting in seconds, defaulting to 0.4, where 0 means no smoothing between the image and the scroll.
  • Includes an easing setting with smooth, spring, and bounce options, plus an overflow boolean and a maxTransition percentage between 1 and 99.
  • Supports the vanilla-only customContainer and customWrapper selectors for scoping the effect to your own markup.
  • Adds a simple-parallax-initialized class to the container once the library has been set up.

Who uses it and how

  • React developers wrap an image in the `` component and pass settings as props, keeping the image in normal document flow.
  • Next.js users working in the App Router place the component inside a Client Component marked with "use client", alongside next/image.
  • Teams without a framework initialize it in plain JavaScript on a class such as .thumbnail or on the result of document.querySelectorAll('img') to animate several images at once.
  • Because the registry files it under Miscellaneous / Design & Prototyping, it also fits prototyping work where a visual scroll effect is needed quickly.

Getting started

Install the package with npm install simple-parallax-js (or the equivalent yarn, pnpm, or bun add command), then import from simple-parallax-js for React or simple-parallax-js/vanilla for the plain JavaScript version. For the React version, react and react-dom at version 17 or above are peer dependencies and are used from your own project.

How it compares

No comparable library is named in the facts for this entry, so it stands alone in this registry. The README contrasts it only with unnamed "other plugins" that it characterises as complex, positioning its own value as simplicity and visual effect rather than feature breadth.

When to use it — and when not to

There is no server, database, or storage to operate, since the whole library runs in the browser, but the settings reference is spread between the README and the project homepage, and some options (customContainer, customWrapper) exist only in the vanilla version. Projects that are not built on React, Next.js, or plain JavaScript will not find an entry point here, and teams that specifically want background-image parallax or effects beyond the documented settings should look elsewhere. The React and vanilla APIs are separate, so a settings choice made in one does not automatically carry over to the other.

project readme (upstream, from github) — read inline
simpleParallax.js

simpleParallax.js

npm version npm downloads types included minzipped size license

simpleParallax.js is a lightweight, easy-to-use React and vanilla-JavaScript library that adds a parallax effect to any image. It works out of the box with React, Next.js, and plain JavaScript — the effect is applied directly to your `` tags, with no background images needed.

While other plugins can be complex, simpleParallax.js is notable for its simplicity and impressive visual effects. Any image can be used. More info in the case study here.

Give it a try!

Installation

Install the package with your favourite package manager:

npm install simple-parallax-js
yarn add simple-parallax-js
pnpm add simple-parallax-js
bun add simple-parallax-js

For the React version, react and react-dom are peer dependencies (>= 17) — they use the React already installed in your project.

The package is written in TypeScript and ships type definitions for both entry points (React and vanilla), so no extra @types package is needed.

Import it:

//React version
import SimpleParallax from 'simple-parallax-js';

//Vanilla Version
import SimpleParallax from "simple-parallax-js/vanilla";

Initialization

React

Simply add the following JavaScript code:


import SimpleParallax from "simple-parallax-js";

const Component = () => (
  <SimpleParallax>
    <img src={"thumbnail.jpg"} alt={"image"} />
  </SimpleParallax>
)

Vanilla

Giving the following HTML :

 <img class="thumbnail" src="image.jpg" alt="image">

simply add the following JavaScript code :

const image = document.getElementsByClassName('thumbnail');
new SimpleParallax(image);

You can also choose to apply the parallax on multiple images :

const images = document.querySelectorAll('img');
new SimpleParallax(images);

Once simpleparallax has been correctly initialized, it adds the simple-parallax-initialized class on the container.

Settings

Setting Type Default Hint
orientation String up up - right - down - left - up left - up right - down left - down right
scale Number 1.5 need to be above 1
overflow Boolean false
delay Number 0.4 in seconds, the time the image takes to catch up with the scroll (0 = no smoothing)
easing String smooth smooth - spring - bounce
maxTransition Number 0 it should be a percentage between 1 and 99
customContainer String or Node '' (Vanilla version only)
customWrapper String '' the selector of the custom wrapper (Vanilla version only)

You can apply these settings with the following JS code :

React

import SimpleParallax from "simple-parallax-js";

const Component = () => (
  <SimpleParallax 
    delay={0}
    orientation={"down"}
    scale={1.5}
    overflow
    maxTransition={60}
  >
    <img src={"thumbnail.jpg"} alt={"image"} />
  </SimpleParallax>
)

Next

In the App Router, use it inside a Client Component:

"use client";

import SimpleParallax from "simple-parallax-js";
import Image from "next/image";

const Component = () => (
  <SimpleParallax 
    delay={0}
    orientation={"down"}
    scale={1.5}
    overflow
    maxTransition={60}
  >
    <Image src={"thumbnail.jpg"} alt={"image"} width={1920} height={1024} />
  </SimpleParallax>
)

Vanilla

var images = document.querySelectorAll('.thumbnail');
new SimpleParallax(images, {
    delay: 0,
    orientation: 'down',
    scale: 1.5,
    overflow: true,
    customContainer: '.container',
    customWrapper: '.wrapper'
});

orientation - String - see example

The parallax effect's orientation, or direction, can be customized. If you choose up, the image will move from bottom to top as you scroll down, and from top to bottom as you scroll up. This same logic applies for all other orientations, including right, down, left, up left, up right, down left, and down right. If two directions are combined, such as down right, the image will move diagonally.

scale - Number - see example

The higher the scale setting, the more pronounced the parallax effect becomes. However, this can cause the image quality to diminish. To mitigate this, if the scale is set at 1.5 and your image width is 500px, simply multiply 500 by 1.5 to get 750. You can then use a 750px image in place of your 500px one to maintain image quality. More information can be found in the case study linked here.

overflow - Boolean - see example

By default, the image scales to create a parallax effect without any overflow on the layout - for a better understanding, review the case study. When overflow is set to true, the image will translate beyond its natural flow, potentially overlapping your content.

delay - Number - see example

Setting a delay prolongs the image's translation even after the user has stopped scrolling, creating a pleasing effect. This delay is measured in seconds: it is roughly the time the image takes to catch up with the scroll. With a delay of 0, the image follows the scroll exactly, with no smoothing.

The smoothing is computed by the plugin on every frame rather than with a CSS transition, so it stays fluid with a mouse wheel and on touch devices. For that reason the plugin sets transition: none on the image: do not rely on a CSS transition of your own on its transform.

easing - String - see example

The easing setting defines how the image catches up with the scroll during the delay. It has no effect when the delay is 0.

  • smooth (default): starts fast and slows down progressively.
  • spring: starts and ends gently, without overshooting.
  • bounce: slightly overshoots the target before coming back. The faster the scroll, the more visible the bounce.

maxTransition - Number - see example

The maxTransition setting controls the extent of the parallax animation. By default, it translates from 0% to 100% of the user's viewport. You can adjust this to any percentage.

customContainer - String or Node - Vanilla version only

Parallax calculations default to the body scroll percentage. However, images may be in a container with its own scroll area. For accurate calculations, set a custom container.

customWrapper - String - Vanilla version only

In some instances, you might want to use your own wrapper instead of the plugin's. Specifying a custom wrapper will add the simpleParallax class and an overflow: hidden style.

Methods

The methods are available in the Vanilla version only.

refresh

Refresh a simpleParallax instance (to recalculate all the positions) :

var images = document.querySelectorAll('img');
var instance = new SimpleParallax(images);
instance.refresh();

By default, the refresh method is fired at every window resize.

destroy

Destroy a simpleParallax instance:

var images = document.querySelectorAll('img');
var instance = new SimpleParallax(images);
instance.destroy();

Examples

You can find all the examples here.

Accessibility

The parallax effect is turned off when the user prefers reduced motion (prefers-reduced-motion: reduce).

Compatibility

simpleParallax.js works in all modern browsers: the latest versions of Chrome, Edge, Firefox, Safari and Opera, on desktop and mobile. The library ships modern ES2020 code; if you need to support older browsers, transpile it with your bundler.

Author

Geoffrey Signorato

Contributing

Open an issue or a pull request to suggest changes or additions.

Frequently asked questions

Is simpleParallax.js free to use?

simpleParallax.js is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does simpleParallax.js do?

A lightweight React & vanilla JavaScript library that adds a parallax effect to any image.

What is simpleParallax.js written in?

simpleParallax.js is primarily written in TypeScript. Its source is publicly available at https://github.com/geosigno/simpleParallax.js, and it has 2,159 GitHub stars.