npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

scroll-parallax-js

v1.0.1

Published

HTML controlled easy to use parallax on scroll.

Downloads

20

Readme

ScrollParallaxJS

NPM package

Light weight Javascript text splitter

ScrollParallaxJS is an easy to use parallax on scroll package. It allow user friendly parallax setings via HTML data-attributes. Only two lines of javascript, non-mandatory custom options, HTML class & attributes and you'r ready to go.

ExampleRepositoryQuestions

Usage

Download the file and include it in your HTML

<script src="/ScrollParallaxJS.js"></script>

Or install and import it as a module

$ npm install scroll-parallax-js

First, import ScrollParallaxJS :

import ScrollParallaxJS from 'scroll-parallax-js';

Then, use ScrollParallaxJS :

<div class="container">
    <!-- You have to wrap your animated elements with .scrollparallaxjs__wrapper -->
    <div class="wrapper scrollparallaxjs__wrapper">
        <!-- You have to use .scrollparallaxjs__el on animated elements -->
        <div
            class="el scrollparallaxjs__el"
            scrollparallaxjs-scale="0.8"
            scrollparallaxjs-y="100"
            scrollparallaxjs-opacity="0.5"
            scrollparallaxjs-duration="1"
        ></div>
        <!-- Define animations on scroll with scrollparallaxjs data attributes -->
        <div
            class="el scrollparallaxjs__el"
            scrollparallaxjs-rotate="45deg"
            scrollparallaxjs-y="-50"
            scrollparallaxjs-delay="0.1"
        ></div>
        <div
            class="el scrollparallaxjs__el"
            scrollparallaxjs-scale="1.2"
            scrollparallaxjs-x="100"
            scrollparallaxjs-y="75"
        ></div>
    </div>
</div>

The css is entirely yours, but you can use my example :

.container {
    width: 100%;
    height: 200vh;
    display: flex;
    justify-content: center;
}

.wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 96rem;
    height: calc(100vh - 8rem);
    top: 4rem;
    border: 1px solid red;
}

.el {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center center;
}
// Select the DOM element wich contains the target animation
const container = document.querySelector('.container');

// Define the container of the parallax and add options
const containerParallax = new ScrollParallaxJS(container, { simultaneous: false });

Options

ScrollParallaxJS comes with multiples options :

{
    duration: '100%',
    triggerHook: 0,
    offset: 0,
    pinned: true,
    indicators: false,
    simultaneous: true,
    prefix: 'scrollparallaxjs'
}

You can overwrite theses options when you create a new parallax :

const container = document.querySelector('.container');
const scrollParallax = new ScrollParallaxJS(container, { duration: 50%, pinned: false, prefix: 'custom-prefix' });

Change log

Releases