New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

parallax-scrolling

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parallax-scrolling

A simple JS library for parallax scrolling effect

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Parallax Scrolling

A lightweight JavaScript library for adding a smooth parallax scrolling effect to elements.

🚀 Features

  • 📜 Simple API – Easily apply parallax effects to any HTML element.
  • Lightweight – No dependencies, just pure JavaScript.

📦 Installation

Install via npm:

npm install parallax-scrolling

🎯 Usage

1. Init

import ParallaxLayer from "parallax-scrolling";
// or
const ParallaxLayer = require("parallax-scrolling");

const parallax = new ParallaxLayer(); 

2. Use it

const element = document.getElementById("parallax-item");

parallax.createLayer(element, { type: "translate", layer: 2, direction: "top" });
parallax.start();

📜 API Reference

new Parallax(options)

OptionTypeDefaultDescription
translatenumber0.5Adjusts the parallax translation speed
scalenumber0.005Adjusts the scaling effect

parallax.createLayer(dom, options = { type, layer, direction, unit })
Registers an element for the parallax effect.

ParameterTypeDefaultDescription
domHTMLElementRequiredThe element to apply the effect on
type"translate", "scale"RequiredThe effect type
layernumberRequiredThe depth of the layer (higher values = slower movement)
direction"Top", "Left", "Right", "Bottom"-The direction of movement
unitstring"px"The CSS unit (px, %, em, etc.)

parallax.start()
Starts the parallax effect (listens for scroll events).

parallax.stop()
Stops the parallax effect.


🌎 Browser Support

Works in all modern browsers (Chrome, Firefox, Edge, Safari).


📜 License

This project is licensed under the MIT License by default.


🙌 Contributing

Contributions are welcome! If you'd like to improve this project:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature-name)
  3. Commit your changes (git commit -m "Add new feature")
  4. Push to the branch (git push origin feature-name)
  5. Open a Pull Request

📬 Contact

  • Github: HyuOniichan
  • Email: chuahetheky@gmail.com

Keywords

FAQs

Package last updated on 29 Jan 2025

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