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

parallax-vanilla

v1.2.3

Published

Simple parallax in pure JavaScript designed for performance and dynamic sizing.

Downloads

18

Readme

parallax-vanilla.js

Seamless and lightweight parallax scrolling library implemented in pure JavaScript utilizing Hardware acceleration for extra performance.

Demo

Main features

Super lightweight without dependencies

A few kilobytes of pure JavaScript.

Viewport-only animations

Parallax elements are only animated within the current viewport, saving a lot of resources.

Dynamic sizing

Image-elements are dynamically sized and adjusted relative to the pv-speed.

Performance is key

Vanilla Parallax maximizes your parallax effects with hardware acceleration and zero external libraries.

Media type independence

The parallax effect applies not only on images but on videos as well. Videos' audio will play if the videos are clicked and remain within the viewport.

Browser support

Tested browsers:

| Chrome | Safari | Firefox | | ------ | ------ | ------- | | 60+ | 10+ | 44+ |

Installation

bower

bower i --save parallax-vanilla

npm

npm i --save parallax-vanilla

Include

  • Include parallax-vanilla.css in <head>
  • Include parallax-vanilla.js just before <body>
<link href="path/to/parallax-vanilla.css" />
<script src="path/to/parallax-vanilla.js"></script>

Usage

Simple usage

1. Wrap a pv-block with a pv-container.

<div class="pv-container">
  <div class="pv-block"></div>
</div>

2. Attach a mediapath to pv-block

<div class='pv-container'>
  <div class='pv-block' pv-mediapath=path/to/file.extension></div>
</div>

3. Initialize library.

<div class='pv-container'>
  <div class='pv-block' pv-mediapath=path/to/file.extension></div>></div>
</div>
<script>
  pv.init()
</script>

JavaScript initialization options

Optional global settings can be configured upon initialization.

pv.init({
  container: {
    class: String,
    height: String || Number,
  },
  block: {
    class: String,
    speed: Number || Float,
    mediapath: String,
    mediatype: String,
    mute: Boolean,
  },
})

JavaScript Settings

Data attributes: Customize individual elements

Data attributes allow fine control over each individual element and will overwrite the global JavaScript settings.

<div class='pv-container' pv-height=100vh>
  <div class='pv-block' pv-speed=3.14 pv-mediatype=video pv-mediapath=path/to/epic_montage.mp4 pv-mute=false></div>
</div>

This code will produce a container with class pv-container with height 100vh containing a block with class pv-block with a parallax speed of 3.14 displaying the media epic_montage.mp4 of type video with pv-mute=false.

The descriptions and the default values are the same as the corresponding properties of the JavaScript settings object.

CSS

The CSS in parallax-vanilla.css is required in order for parallax-vanilla to function properly.

.pv-container {
  ...;
}
.pv-container .pv-block {
  ...;
}
.pv-container .pv-block video {
  ...;
}
.audio-icon {
  ...;
}

LICENSE

MIT