Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parallax-element

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parallax-element

jQuery plugin to add parallax effect to individual elements

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

parallax-element.js

jQuery plugin that creates parallax effect for specific element.

Usage and Defaults

The scroll animation speed is based upon either a data-speed attribute in a html tag or the defaultSpeed option.

The speed value (integer) should be kept between -1 and 1.

A positive number makes the element appear to scroll slowly downward, while a negative integer makes the element appear to scroll slowly upward.

Javascript file:

// Default usage
$('.element').parallaxElement();

// Options
$('.element').parallaxElement({
  defaultSpeed:  0.2,   // Integer - Default speed if `data-speed` is not present
  useOffset:     true,  // Boolean - Whether or not to start animations below bottom of viewport
  defaultOffset: 200,   // Distance before element appears to start animation
  disableMobile: false, // Boolean - allow function to run on mobile devices
  minWidth:      false  // Integer - minimum width the function should fire
});

To assign different speeds to indivudual elements, use the data-speed attribute in html:

<div class="element" data-speed="0.1">
  <!-- do stuff -->
</div>

<div class="element" data-speed="0.2">
  <!-- do stuff -->
</div>

<div class="element" data-speed="-0.1">
  <!-- do stuff -->
</div>

Browserify

Make sure to shim jQuery and then simply require the file:

require('parallax-element');

$('.element').parallaxElement({
  defaultSpeed: 0.1
});

Keywords

FAQs

Package last updated on 08 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc