All Projects → diegoversiani → smooth-parallax

diegoversiani / smooth-parallax

Licence: MIT license
Smooth Parallax makes it a lot easier to move objects when the page scroll with ease.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to smooth-parallax

react-rellax
React Parallax component using Rellax.js
Stars: ✭ 39 (-40.91%)
Mutual labels:  parallax, parallax-scrolling, parallax-javascript-library
universal-parallax
Easy parallax plugin using pure javascript. Also works on mobile platforms. Cross browser support.
Stars: ✭ 107 (+62.12%)
Mutual labels:  parallax, parallax-scrolling, parallax-javascript-library
Perspective
🖼Parallax scrolling effect. And more.
Stars: ✭ 80 (+21.21%)
Mutual labels:  parallax, parallax-scrolling, parallax-javascript-library
Parallaxie
Easiest, Responsive and Customizable Parallax jQuery Plugin
Stars: ✭ 65 (-1.52%)
Mutual labels:  parallax, parallax-scrolling, parallax-javascript-library
Rallax.js
Dead simple parallax scrolling.
Stars: ✭ 1,441 (+2083.33%)
Mutual labels:  parallax, parallax-scrolling
hongkong
A parallax scroll effect plugin
Stars: ✭ 46 (-30.3%)
Mutual labels:  parallax, parallax-scrolling
Locomotive Scroll
🛤 Detection of elements in viewport & smooth scrolling with parallax.
Stars: ✭ 4,231 (+6310.61%)
Mutual labels:  parallax, smooth-scrolling
Smooth Scrolling
smooth scrolling and parallax effects on scroll
Stars: ✭ 514 (+678.79%)
Mutual labels:  parallax, smooth-scrolling
Rolly
Custom scroll with inertia, smooth parallax and scenes manager
Stars: ✭ 109 (+65.15%)
Mutual labels:  parallax, smooth-scrolling
Jztvosparallaxbutton
📺 tvOS Button with Parallax Effect (ObjC)
Stars: ✭ 161 (+143.94%)
Mutual labels:  parallax
React Parallax Tilt
👀 Easily apply tilt hover effect on React components - lightweight/zero dependencies
Stars: ✭ 243 (+268.18%)
Mutual labels:  parallax
Mpparallaxview
Apple TV Parallax effect in Swift.
Stars: ✭ 1,727 (+2516.67%)
Mutual labels:  parallax
Flutter parallax scroll
Flutter UI challenge- Parallax scroll effect
Stars: ✭ 172 (+160.61%)
Mutual labels:  parallax
React Parallax Component
Easiest way to add scroll parallax effect on the component
Stars: ✭ 143 (+116.67%)
Mutual labels:  parallax
stylised-character-controller
A stylised physics based character controller made in Unity 3D.
Stars: ✭ 100 (+51.52%)
Mutual labels:  movement
Vue Prlx
🔮 Vue.js parallax directive you were looking for (can animate translate & background-position)
Stars: ✭ 140 (+112.12%)
Mutual labels:  parallax
Parallaxrecyclerview
Parallax effect on every item of your RecyclerView.
Stars: ✭ 237 (+259.09%)
Mutual labels:  parallax
Arsegmentpager
segment tab controller with parallax Header
Stars: ✭ 1,691 (+2462.12%)
Mutual labels:  parallax
Slidemenulayout
🔥An android slide menu that supports left and right swipes and slides with parallax.(一个支持左右滑动并带有视差滑动效果的安卓侧滑菜单控件.仿[QQ/探探侧滑])
Stars: ✭ 235 (+256.06%)
Mutual labels:  parallax
Backgroundvideo
A lightweight parallax background video solution that behaves like the CSS3 property, background-size: cover
Stars: ✭ 234 (+254.55%)
Mutual labels:  parallax

Smooth Parallax

npm version DragsterJS gzip size

Parallax that doesn't suck! No jQuery required, just plain 'ol javascript.

Smooth Parallax makes it easy to move objects when you scroll, being it images, divs or what-have-you. Use it to add that background or foreground parallax effect to your website or create a moving scene with a hippie van :)

Enjoy using Smooth Parallax?

If you enjoy using Smooth Parallax and want to say thanks, you can leave me a small tip. All payments are securely handled through PayPal.

Buy Me a Coffee at ko-fi.com

Installation

Setting up is pretty straight-forward. Just download the script from dist folder and include it in your HTML:

<script type="text/javascript" src="path/to/smooth-parallax.min.js"></script>

Smooth Parallax also supports AMD / CommonJS

// AMD
require(["path/to/smooth-parallax"], function(SmoothParallax) {});

// CommonJS
var SmoothParallax = require("smooth-parallax");

NPM / Bower

Smooth Parallax is also available on NPM and Bower:

npm install smooth-parallax      # npm
bower install smooth-parallax    # bower

Basic Usage

Init

Just call SmoothParallax.init() to get objects moving and configure elements movement.

<script type="text/javascript">
  window.addEventListener("load", function () {
    SmoothParallax.init();
  });
</script>

Smooth Parallax will automatically look for all objects with the attribute smooth-parallax (ie.: <img src="images/hippie-van.png" smooth-parallax="">).

Configure elements movement

You'll also have to set at least one more attribute start-position or end-position, see options at standard options.

Standard Options

Global Options

These options are passed to the init function when starting Smooth Parallax.

  • basePercentageOn Set how you want to track scroll percentage:
    • containerVisibility default: scroll percentage for each moving object is calculated only when the element's container is visible in the viewport. This prevents objects from moving while not visible.
    • pageScroll: scroll percentage is based on the page scroll and is the same for all moving objects.

Elements Options

These options are passed as html attributes to the moving elements and define how that element movement behaves.

All percentage values are in decimal form, ie.: 1 = 100%. You can also set values greater than 1 and smaller than 0, ie.: -0.5 = -50% or 1.25 = 125%.

  • start-movement - define at what scroll percentage to start moving the object. Default value is 0.0;
  • end-movement - define at what scroll percentage to stop moving the object. Default value is 1.0.
  • start-position-x - define the horizontal start position of the element in percentage of its the base-size (see option below).
  • start-position-y - define the vertical start position of the element in percentage of its the base-size (see option below).
  • end-position-x - define the horizontal end position of the element in percentage of its the base-size (see option below).
  • end-position-y - define the vertical end position of the element in percentage of its the base-size (see option below).
  • container - change the elements container element user to calculate its position, default is moving element's parent node.
  • base-size - define how to calculate the base size of the movement, used to calculate the target position.
    • elementSize: calculate based on the element size itself.
    • containerSize: calculate based on the elements container size.

Contributing to Development

This isn't a large project by any means, but I'm definitely welcome to any pull requests and contributions.

You can get your copy up and running for development quickly by cloning the repo and running npm:

$ npm install

This will install all the necessary tools for compiling minified files.

Change Log

1.1.2

  • Improvement: Extend public method getScrollPercent to return scroll percentage for elements.
  • Fix: issue calculating element's size for SVG on Firefox
  • Fix: position calculation to 2 decimals precision for better performance.
  • Fix: scroll percent calculation based on containerSize.

1.1.1

  • Fix npm package.json info.

1.1.0

Upgrade Notice: This version changes how Smooth Parallax is initiated and how the elements options are set.

  • Converted script into a javascript plugin.
  • Renamed html attributes:
    • data-smooth-parallax-element > smooth-parallax
    • data-start-percent > start-movement
    • data-end-percent > end-movement
    • data-start-x > start-position-x
    • data-start-y > start-position-y
    • data-end-x > end-position-x
    • data-end-y > end-position-y
    • data-smooth-parallax-element > smooth-parallax
    • data-container-id > container.
  • Changed element option container expected value to be a valid css selector instead of element id.
  • Added element option base-size.
  • Added global option pageScroll.

1.0.0

  • Initial release

License

Licensed under MIT. Enjoy.

Acknowledgement

Smooth Parallax was created by Diego Versiani for a better Parallax Effect.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].