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

js-scroll-animations

v0.9.2

Published

Simple and lightweight library for scroll animations

Downloads

17

Readme

⭥ JS Scroll Animations

License: MIT

JS Scroll Animations is a simple and lightweight library for scroll animations. Follow the instructions below to set it up.

Highlights

  1. Vanilla JS
  2. Easy setup using HTML dataset property
  3. JS Actions
  4. CSS Animations

Instructions

1. Install or download the package

Download or install the package using a package manager:

yarn add js-scroll-animations

or

npm i js-scroll-animations

2. Import the package assets

In your HTML file, add the following link and script tags:

<link
  rel="stylesheet"
  href="../node_modules/js-scroll-animations/dist/styles.css"
/>
<script src="../node_modules/js-scroll-animations/dist/js-scroll-animations.js"></script>

Alternatively, if you are using a module bundler, you can import the assets in your JavaScript file:

import jsScroll from "js-scroll-animations";
import "js-scroll-animations/dist/styles.css";

3. Add the dataset property to the elements you want to animate

Add the data-jsscroll property to activate the scroll animation for an element. You can use other dataset properties to configure the animation, such as data-jsscroll-delay and data-jsscroll-threshold. For example:

<div
  data-jsscroll
  data-jsscroll-delay="200"
  data-jsscroll-threshold="1"
  data-jsscroll-slide-top
  class="box"
>
  content
</div>

4. Initialize the animations

Initiate the animations with the following code:

const jsScroll = jsScrollAnimations();
jsScroll.init();

That's it! Check the demo page to see how it works and how to set it up.

Properties

The following table shows the available dataset properties that you can use to configure the scroll animations:

| PROPERTY | DEFAULT | DESCRIPTION | | ---------------------------- | ------- | -------------------------------------------------------------------------------------------------------- | | data-jsscroll | | Activate scroll animation for the element. A fade-in animation will be used as the default. | | data-jsscroll-delay | 0 | A delay to trigger the animation when the element is in the view. | | data-jsscroll-threshold | 1.25 | Threshold to adjust when the animation will be triggered based on the element's y position and the view. | | data-jsscroll-fade-in | | Fade-in animation. | | data-jsscroll-slide-top | | Slide from the bottom to the top of the element position animation. | | data-jsscroll-slide-bottom | | Slide from the top to the bottom of the element position animation. | | data-jsscroll-slide-left | | Slide from the left to the right of the element position animation. | | data-jsscroll-slide-right | | Slide from the right to the left of the element position animation. |

Actions

The following table shows the available JS actions available to control the animations:

| ACTION | DESCRIPTION | | --------- | ---------------------------------------------------------------------------------------------------------- | | init | Initiate the scroll animations. | | pause | Pause the scroll animations for the non-triggered animations. Use init to resume the animations. | | reset | Resets all elements to their non-animated state, which will trigger the animations again when scrolled to. | | disable | Disables all animations, making all elements visible. |


This project was created by Wander Lima and is licensed under the MIT license.