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 🙏

© 2025 – Pkg Stats / Ryan Hefner

jquery-data-parallax

v0.2.0

Published

Create super fast parallax effects using data attributes.

Readme

[data-parallax]

Create super fast parallax effects using data attributes.

  • written in native Javascript for best performance
  • uses translate3d to ensure GPU acceleration
  • uses single ticking requestAnimationFrame() method
  • uses HSV color model for color interpolation
  • intuitive default values, no need to type many parameters

Examples

See Examples

Availability

bower install jquery-data-parallax

Installation

<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/jquery.requestAnimationFrame/jquery.requestAnimationFrame.min.js"></script>
<script src="bower_components/jquery-data-parallax/jquery.data-parallax.min.js"></script>

Usage

Either use data attributes:

<div data-parallax='{"y":"70%","scale":2,"rotate":180,"opacity":0}'></div>

or javascript:

$("#selector").parallax({
    "y": "70%",
    "scale": 2,
    "rotate": 180,
    "opacity": 0
});

Properties

All properties can be specified as number or string or object.
Using the object syntax you can explicitly pass in a from value (optional), as well as override global options:

<div data-parallax='{"opacity":{"to":1,"from":0.5,"duration":100},"translateY":"50%","duration":200}'></div>

Currently supported properties:

pin

Type: boolean or selector

Make an elements' position fixed during the scene.

class

Type string

Adds one or more classes to the element during the scene.

x

Type: number or string (percentage or viewport units)

translateX. Percentages in this case are relative to the duration.

y

Type: number or string (percentage or viewport units)

translateY. Percentages in this case are relative to the duration.

z

Type: number or string (percentage or viewport units)

translateZ. Percentages in this case are relative to the duration.

scale or scaleX and scaleY

Type: number or string (percentage)

rotate

Type: number or string (percentage)

Rotation in degrees.

color

Type: string (e.g. "#ff0000")

Hex or rgb() color string.

backgroundColor

Type: string (e.g. "#ff0000")

Hex or rgb() color string.

opacity

Type: number (0 - 1)

top

Type: number or string (percentage or viewport units)

Better use "y" where possible.

left

Type: number or string (percentage or viewport units)

Better use "x" where possible.

width

Type: number or string (percentage or viewport units)

Better use "scaleX" where possible.

height

Type: number or string (percentage or viewport units)

Better use "scaleY" where possible.

backgroundPositionX

Type: number or string (percentage or viewport units)

Better use "x" where possible.

backgroundPositionY

Type: number or string (percentage or viewport units)

Better use "y" where possible.

Options

Options can be specified for all properties:

<div data-parallax='{"y":"70%","opacity":1,"duration":"150%"}'></div>

as well as (overridden) for each individually:

<div data-parallax='{"y":"70%","opacity":{"to":1,"duration":"85%"},"duration":"150%"}'></div>

Available options:

All options are optional.

offset

Type: number or string (percentage or viewport units) or callback function
Default: 0

If you need to start the scene on an absolute offset or after/before "triggerElement"'s offset.

duration

Type: number or string (percentage or viewport units) or callback function
Default: as long as it's needed to scroll past the element

Percentages are calculated against element dimensions rather than viewport: "50%" == 0.5 * $(el).outerWidth(true).
For viewport relative values, use viewport units: vh or vw: "100vh" == $(window).height().
Setting duration to "0" will run it till the end of document.

triggerElement

Type: selector
Default: the element

Use this if you need another element to act as the trigger. It's not recommended to set this to "null" or "false", because working with absolute offsets can become difficult when you need to change things.

triggerHook

Type: number or string (percentage or viewport units) or callback function
Default: "100%" ("0%" for "pin" property)

0% is top of the viewport and 100% is bottom of the viewport.

ease

Type: string or callback function
Default: "linear"

axis

Type: string ("x" or "y")
Default: "y"

enableTouchDevices

Type: boolean
Default: false

This is per element / selector option.

Global options:

enableTouchDevices

Type: boolean
Default: false

By default [data-parallax] is disabled on touch devices. To make it work add after including the js file:

$.parallax.enableTouchDevices = true;

Credits

This plugin was inspired from Parallax Done Right and Perfecting Parallax Scrolling