Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parallaxjs

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parallaxjs

Simple Parallax on DOM elements.

  • 2.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
0
Weekly downloads
 
Created
Source

parallaxjs

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

Simple Parallax on DOM elements.

paypal coinbase twitter

Installation

npm install parallaxjs

Usage

<div class="layer" data-parallax-speed="3">Parallax layer</div>
<div class="layer" data-parallax-speed="1.5">Other layer that moves faster</div>
import Parallax from "parallaxjs";
const parallax = new Parallax(document.querySelectorAll(".layer"));

// Add parallax handlers to your own listeners (so that you can debounced them or whatever)
window.addEventListener("scroll", () => parallax.onScroll());
window.addEventListener("resize", () => parallax.onResize());

API

Parallax

Parallax ⏏

Simple Parallax on DOM elements.

Kind: Exported class

new Parallax(elements, options)

Creates an instance of Parallax.

ParamTypeDescription
elementsArray.<HTMLElement>Elements to be transformed.
optionsOptions

Parallax~Direction : "x" | "y"

Parallax direction (x or y).

Kind: inner typedef of Parallax

Parallax~Options : object

Kind: inner typedef of Parallax Properties

NameTypeDefaultDescription
[speed]number1Parallax relative speed.
[offset]number0.5Offset (0 to 1) relative to window height.
[heightOffset]number0Offset (0 to 1) relative to element height.
[direction]Direction"y"Parallax direction.
[min]number-InfinityMinimum translation.
[max]numberInfinityMaximum translation.
[background]booleanfalseApply parallax to background position instead of transform.

License

MIT. See license file.

Keywords

FAQs

Package last updated on 06 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc