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

pure-parallaxify

v0.0.4

Published

A pure parallax plugin without dependencies, with a performance boost.

Downloads

51

Readme

Pure Parallaxify

Add depth to your project! pure parallaxify is a vanilla js plugin that adds parallax effects to elements and backgrounds based on mouse movement.

Download

You can install this plugin using npm or yarn:

npm install pure-parallaxify
or
yarn add pure-parallaxify

Or you can use the CDN in your HTML:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/pure.parallaxify.js"></script>

Get things going

In order to add a parallax effect to any element you can run new Parallaxify() on the wrapper of an element or run it globally on window:

// Run it on single element
new Parallaxify({}, "#my-wrapper");

// or globally
new Parallaxify();

But, first, you need to add one of these attributes to your tags to detected by Parallaxify:

  • data-parallaxify-range
  • data-parallaxify-range-x
  • data-parallaxify-range-y
<div data-parallaxify-range-x="50" data-parallaxify-range-y="100"></div>

Customize the plugin

Pure Parallaxify exposes a variety of options that let you influence how element positioning is achieved, configure filtering of sensor data, configure the movement algorithm, and change general plugin settings.

new Parallaxify({
  // enable parallax effect for horizontal, vertical or both directions
  horizontalParallax: true,
  verticalParallax: true,

  // enable or disable parallax effect for elements or backgrounds
  parallaxBackgrounds: true,
  parallaxElements: true,

  // set which positioning property is to be used
  // options include 'position' or 'transform' using css transformations
  positionProperty: "position",

  // enable for responsive layouts
  // (upon orientation changes or window resizing element positions are reevaluated
  responsive: false,

  // enable or disable mouse or gyroscope data as input for the plugin
  useMouseMove: true,
  useGyroscope: true,

  // use a Low Pass Filter to smooth sensor readings (1 = no filter)
  alphaFilter: 0.9,

  // set which motion type algorithm is to be used
  // options include 'natural', 'linear', 'gaussian', or 'performance'
  motionType: "natural",
  mouseMotionType: "gaussian",

  // define which sensor input has priority over the other
  // options are either 'mouse' or 'gyroscope'
  inputPriority: "mouse",

  // define the delta angle (0 < motionAngle < 90)
  // that is used to render max parallax in this direction
  motionAngleX: 80,
  motionAngleY: 80,

  // enable of adjustment of base position (using a Low Pass Filter)
  // (adapting to device usage while plugin is running)
  adjustBasePosition: true,
  // alpha for Low Pass Filter used to adjust average position
  alphaPosition: 0.05,
});

License

Released under the MIT license.

Thanks

I have used Felix Pflaum's Parallaxify plugin for jQuery. So I did refactored some parts and published it for vanilla js to be used in other frameworks too.