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

animate-on-scroll

v1.2.5

Published

JQuery plugin for animating (through CSS) objects as they enter or leave the screen.

Downloads

320

Readme

animate-on-scroll

JQuery plugin for animating objects as they enter or leave the screen.

Animate-on-scroll is designed for simplicity, flexibility and extendibility

'fade' and 'scale3d' animations are currently supported, but you can easily extend that to whatever CSS animations you like!

The only prerequisite for extending this plugin is that the function must accept two parameters: the element, and the transform value.

See source code for more details.

Install

npm -- a JavaScript package manager

npm install animate-on-scroll

Use examples

The simplest use:

$('.fade-on-scroll').animateOnScroll();

This enables fade effect and scale3d effect by default.

If you're unhappy with the defaults, you can customize the options. Suppose we don't want scale3d:

$('.fade-on-scroll').animateOnScroll({
  scale3d: false
});

The following code makes all elements with class '.fade-on-scroll' fade out of the screen with a top offset of 120 and a bottom offset of 60.

Also, disables the scale3d effect.

$('.fade-on-scroll').animateOnScroll({
  fade: {
    offset_top: 120,
    offset_bottom: 60
  },
  scale3d: {
    enable: false
  }
});

If we want to scale only the items with class 'scale3d-on-scroll':

$('.scale3d-on-scroll').animateOnScroll({
  scale3d: {
    enable: true,
    offset_top: 40,
    offset_bottom: -30
  }
});

If we want to rotate some objects as they enter and leave the screen, we can supply our own special range and rotate function:

$('.rotate-on-scroll').animateOnScroll({
  rotate: {
    enable: true,
    range: [0,360],
    apply_css: (el, v) -> el.css 'transform', 'rotate(' + v + 'deg)'
  }
});

Any function and range will do!

An item can have multiple classes and effects.

Options

All supported options and respective defaults:

fade: {
  enable: true,
  offset_top: 50,
  offset_bottom: 50,
  range: undefined,
  apply_css: (el, v) -> el.css 'opacity', v
}
scale3d: {
  enable: true,
  offset_top: undefined,
  offset_bottom: undefined,
  range: undefined,
  apply_css: (el, v) -> el.css 'transform', 'scale3d(' + v + ',' + v + ',' + v + ')'
}

Web resources

https://www.npmjs.com/package/animate-on-scroll

http://github.com/psteiger/animate-on-scroll

Do you use this library?

Please contact me (mailto:[email protected]) so we display your website here!

Please donate!

This software's free and forever will be. If you like it, please consider donating any amount you like.