Tiny vue component that adds a directive for parallax effect on elements.

Overview

vue-parallax-js

Tiny vue component that adds a directive for parallax effect on elements.

  • no dependencies
  • lightweight
  • 1.3k gzip

Setup

npm install --save vue-parallax-js
# or use yarn
yarn add vue-parallax-js

in your main JavaScript file

// import Vue and vue-parallax-js
import Vue from 'vue'
import VueParallaxJs from 'vue-parallax-js'

// add vue-parallax-js to vue
Vue.use(VueParallaxJs)

Usage

when everything is setup you can use the directive like this:

<h1 v-parallax="0.2">vue-parallax-js</h1>

Options

Vue.use(VueParallaxJs, options)
const options = {
  minWidth: Number,   /* minumum window width for parallax to take effect */
  className: String,  /* this class gets added to all elements
                      that are being animated, by default none */
  container: String,  /* element that actually scrolls, by default it's window */
}

Modifiers

when using the v-parallax directive you can also pass some modifiers to configure the instance of vue-parallax-js

<h1 v-parallax.modifier="0.2">vue-parallax-js</h1>
Modifier Description
horizontal horizontal based parallax
centerX will add transform: translateX(-50%) along with the parallax positioning
absY uses the window height instead of the element height for the calculations
Comments
  • solving the bug that occurs when navigating between routes - spa

    solving the bug that occurs when navigating between routes - spa

    When navigating between routes, in a nuxt spa, the elements with parallax on them have unexpected positioning. But on refresh everything is back to normal. We solved this issue. Please check our code. Thank You!

    opened by oanamihet 6
  • error The token provided must not be empty

    error The token provided must not be empty

    Hello, with vue 2.5.13 and nuxt next version i get this error:

    Failed to execute 'add' on 'DOMTokenList': The token provided must not be empty.
    An error occurred while rendering the page. Check developer tools console for details.
    
    client.js?a0f2:52 DOMException: Failed to execute 'add' on 'DOMTokenList': The token provided must not be empty.
        at ParallaxJS.add (webpack-internal:///./node_modules/vue-parallax-js/lib/vue-parallax-js.es.js:1:657)
        at inserted (webpack-internal:///./node_modules/vue-parallax-js/lib/vue-parallax-js.es.js:1:1636)
        at callHook$1 (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:6192:7)
        at callInsert (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:6131:9)
        at _update (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:6137:7)
        at Array.updateDirectives (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:6095:5)
        at patchVnode (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:5830:62)
        at updateChildren (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:5721:9)
        at patchVnode (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:5835:29)
        at updateChildren (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:5721:9)
    

    example of html code:

    <div class="slider-inner swiper-home" v-parallax="0.1">
    ...
    

    before it worked well with vue 2.4.2 and nuxt 1.0.0-rc11

    opened by javialon26 4
  • New Feature : Horizontal based parallax

    New Feature : Horizontal based parallax

    Hi, I was looking for a vue parallax plugin on Vue Awesome Parallax section this plugin was the only one working not only on images, but I found out that horizontal parallax was not implemented. I tried my best to follow the code syntax and style, hope you like it !

    opened by NicolasMrc 3
  • any way to reposition element

    any way to reposition element

    Hey there,

    is there any way to reposition the element because after i applied v-parallax to it it has a different position. It is slightly lower positioned than withough the directive on it.

    I could archive this of course by using css but it is a hassle to do this on every element i want to have the parallax effect on.

    Any help would be appreciated :)

    Greetings and thanks in advance,

    Sebastian Jung

    opened by sebastianjung 3
  • Perf In view port

    Perf In view port

    Hello,

    Is it possible to add a in view port check to improve performance ?

    like in this project: https://github.com/erikengervall/parallax-vanilla/blob/master/src/js/translate.js

    Would you some help to archive this ?

    enhancement help wanted 
    opened by ArrowBaZ 3
  • Remove global variable mutation

    Remove global variable mutation

    The original package mutated "window" and "document" global variables to null when they're undefined. This caused a problem with Vuex and Nuxt.js.

    opened by Neo-Zhixing 2
  • Add option for scroll container

    Add option for scroll container

    On a recent project I needed the ability for the parallax to happen on the scroll of an element besides body. I forked the project and added an extra option to specify the container element that has the scroll event.

    If this needs cleaned up more or if you have suggestions on how we can improve it/make it more flexible I'm totally open to making changes.

    opened by glitchedmob 2
  • Update on scroll

    Update on scroll

    This update fixes the issue when you have another element in the same window which changes the window height. Updating the parallax on window scroll fixes the issue.

    opened by michelmany 2
  • Default value of direction should be up

    Default value of direction should be up

    hey there,

    thanks for that awesome package. Just wanted to say, that the default direction states 'down' in the readme of this repo but it should be 'up' i guess.

    Best regards,

    Sebastian

    opened by sebastianjung 2
  • Adding additional class name to parallaxing element

    Adding additional class name to parallaxing element

    Hello :) IMO, this will be helpful for accident situations when plugin is off and your elements have specific styles for parallax. For example, your element without parallax should be at position {top: 10px} and with parallax - at {top: -10px}.

    opened by nbrylevv 2
  • Browserify Issue

    Browserify Issue

    Hello!

    Excellent plugin! This might be an issue with my development workflow -- but might be worth mentioning.

    /Users/mmarquez/.../parallax-test/node_modules/vue-parallax-js/vue-parallax-js.js:77 export default { ^ ParseError: 'import' and 'export' may appear only with 'sourceType: module'

    I can't seem to be able to run this directive using Browserify + Vue CLI Templates. By the console log it seems to be an issue with the babel.config, but I can't seem to be able to get it to work.

    Everything works fine using Nuxt.js, which is Webpack based for compilation.

    Any help would be appreciated -- most of my production sites are developed using Browserify and would like to implement this simple directive in some!

    Thanks!

    opened by mmmarquez 2
  • Bump chownr from 1.0.1 to 1.1.4

    Bump chownr from 1.0.1 to 1.1.4

    Bumps chownr from 1.0.1 to 1.1.4.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump tar from 4.4.2 to 4.4.19

    Bump tar from 4.4.2 to 4.4.19

    Bumps tar from 4.4.2 to 4.4.19.

    Commits
    • 9a6faa0 4.4.19
    • 70ef812 drop dirCache for symlink on all platforms
    • 3e35515 4.4.18
    • 52b09e3 fix: prevent path escape using drive-relative paths
    • bb93ba2 fix: reserve paths properly for unicode, windows
    • 2f1bca0 fix: prune dirCache properly for unicode, windows
    • 9bf70a8 4.4.17
    • 6aafff0 fix: skip extract if linkpath is stripped entirely
    • 5c5059a fix: reserve paths case-insensitively
    • fd6accb 4.4.16
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump path-parse from 1.0.5 to 1.0.7

    Bump path-parse from 1.0.5 to 1.0.7

    Bumps path-parse from 1.0.5 to 1.0.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump hosted-git-info from 2.6.0 to 2.8.9

    Bump hosted-git-info from 2.6.0 to 2.8.9

    Bumps hosted-git-info from 2.6.0 to 2.8.9.

    Changelog

    Sourced from hosted-git-info's changelog.

    2.8.9 (2021-04-07)

    Bug Fixes

    2.8.8 (2020-02-29)

    Bug Fixes

    • #61 & #65 addressing issues w/ url.URL implmentation which regressed node 6 support (5038b18), closes #66

    2.8.7 (2020-02-26)

    Bug Fixes

    • Do not attempt to use url.URL when unavailable (2d0bb66), closes #61 #62
    • Do not pass scp-style URLs to the WhatWG url.URL (f2cdfcf), closes #60

    2.8.6 (2020-02-25)

    2.8.5 (2019-10-07)

    Bug Fixes

    • updated pathmatch for gitlab (e8325b5), closes #51
    • updated pathmatch for gitlab (ffe056f)

    2.8.4 (2019-08-12)

    ... (truncated)

    Commits
    • 8d4b369 chore(release): 2.8.9
    • 29adfe5 fix: backport regex fix from #76
    • afeaefd chore(release): 2.8.8
    • 5038b18 fix: #61 & #65 addressing issues w/ url.URL implmentation which regressed nod...
    • 7440afa chore(release): 2.8.7
    • 2d0bb66 fix: Do not attempt to use url.URL when unavailable
    • f2cdfcf fix: Do not pass scp-style URLs to the WhatWG url.URL
    • e1b83df chore(release): 2.8.6
    • ff259a6 Ensure passwords in hosted Git URLs are correctly escaped
    • 624fd6f chore(release): 2.8.5
    • Additional commits viewable in compare view
    Maintainer changes

    This version was pushed to npm by nlf, a new releaser for hosted-git-info since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump lodash from 4.17.19 to 4.17.21

    Bump lodash from 4.17.19 to 4.17.21

    Bumps lodash from 4.17.19 to 4.17.21.

    Commits
    • f299b52 Bump to v4.17.21
    • c4847eb Improve performance of toNumber, trim and trimEnd on large input strings
    • 3469357 Prevent command injection through _.template's variable option
    • ded9bc6 Bump to v4.17.20.
    • 63150ef Documentation fixes.
    • 00f0f62 test.js: Remove trailing comma.
    • 846e434 Temporarily use a custom fork of lodash-cli.
    • 5d046f3 Re-enable Travis tests on 4.17 branch.
    • aa816b3 Remove /npm-package.
    • See full diff in compare view
    Maintainer changes

    This version was pushed to npm by bnjmnt4n, a new releaser for lodash since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump elliptic from 6.5.3 to 6.5.4

    Bump elliptic from 6.5.3 to 6.5.4

    Bumps elliptic from 6.5.3 to 6.5.4.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Owner
Brendan Mullins
Brendan Mullins
Scrolls a image slower than the window to create a neat optical effect.

vue-parallax Scrolls a image slower than the window to create a neat optical effect. Demo Install npm install --save-dev vue-parallax // [email protected] npm i

null 84 Nov 30, 2022
A plugin of Vue that adds a directive for parallax effect by rellax.js.

A plugin of Vue that adds a directive for parallax effect by rellax.js.

crouton 41 Sep 27, 2022
A component creating a parallax effect on an image within a container

A component creating a parallax effect on an image within a container Install npm install --save-dev vue-js-parallax-component Usage import VueParalla

Jurian Koning 0 Dec 16, 2019
Adds a directive that listens for click events and scrolls to elements.

vue-scrollto DEMO Scrolling to elements was never this easy! This is for vue 2.x and vue 3.x (since v2.19.0) For vue 1.x use [email protected] (note

Igor Randjelovic 2k Dec 31, 2022
Adds a directive that listens for click events and scrolls to elements.

vue-scroll-to Vue.js directive that listens for click events and scrolls to elements. Install With npm do: $ npm install vue-scroll-to --save or $ yar

Kevin Houghton 17 Jul 15, 2022
Create a beautiful cut effect to your fixed element and change its color with cut effect when scrolling

Chameleons for Vue.JS (BETA) Create a beautiful cut effect to your fixed element and change its color with cut effect when scrolling. Zero dependecy.

Elvis Gómez 2 Jun 30, 2021
This Vue (2.x / 3.x) plugin adds a v-resizable directive to make an element resizable

This Vue (2.x / 3.x) plugin adds a v-resizable directive to make an element resizable. Unlike the CSS resize property, the element may be resized from any side or corner, and a resize event is emitted.

Kevin Lee Drum 3 Aug 31, 2022
Material Ripple Effect as Vue Directive.

Material Ripple Effect Material Ripple Effect as Vue Directive. This directive it's meant to be used in any element in which you like to achieve such

Pygmy Slow Loris 284 Dec 22, 2022
🌊Vue.js directive for ripple effect.

?? v-ripple-directive Vue.js directive for ripple effect. ✨ Features lightweight (~964b gzip). fully customizable during runtime/build. build upon CSS

Andrew 4 Dec 25, 2022
A tiny Vue directive that stop propagation scroll when edge reached

vue-scroll-stop A tiny Vue directive that stop propagation scroll when edge reached. Works with desktop mousewheel and mobile touchmove events ✅ On ❌

Volodymyr Antoniuk 41 Feb 4, 2022
🔡 Tiny input mask library for Vue.js (directive)

?? Tiny input mask library for Vue.js (directive)

Max Liashuk 836 Dec 20, 2022
🌌 Vue.js component for parallax image scroll effects

vue-parallaxy Is a compontent for fast 60fps parallax scroll effects in vue 2. Demo Demo here Install npm install vue-parallaxy or yarn add vue-parall

Jakub 628 Dec 20, 2022
A simple vue component to add parallax background images

Vue Parallax A simple vue component to add parallax background images. Installation npm install @netsells/vue-parallax or yarn add @netsells/vue-paral

Netsells 0 Jan 31, 2019
Tiny (2k gzipped) input/directive mask for currency

v-money Mask for Vue.js Features Lightweight (<2KB gzipped) Dependency free Mobile support Component or Directive flavors Accept copy/paste Editable F

Vue.js Tips 743 Dec 28, 2022
A tiny, SSR-safe directive for binding random data to an element.

1️⃣ vue-bind-once A tiny, SSR-safe directive for binding random data to an element. A tiny, SSR-safe directive for binding random data to an element.

Daniel Roe 112 Dec 27, 2022
The parallax are a common way for users to interact, implemented using Vue hooks

The parallax are a common way for users to interact, implemented using Vue hooks. Support both vue3 and vue2,You need to install plug-ins vue-composition-api in vue2 。

TommyShao 3 Dec 7, 2022
Starter template for parallax effects & smooth scrolling experience. Empower your Nuxt project in no time.

Starter template for parallax effects & smooth scrolling experience. Empower your Nuxt project in no time.

Ivo Dolenc 42 Dec 11, 2022
Starter template for parallax effects & smooth scrolling experience

Nuxt + Locomotive Scroll Starter template for parallax effects & smooth scrolling experience. Empower your Nuxt project in no time. See it in action →

Ivo Dolenc 42 Dec 11, 2022
Starter template for parallax effects & smooth scrolling experience

Nuxt + Locomotive Scroll Starter template for parallax effects & smooth scrolling experience. Empower your Nuxt project in no time. See it in action →

Ivo Dolenc 42 Dec 11, 2022
Atropos is a lightweight, free and open-source JavaScript library to create stunning touch-friendly 3D parallax hover effects.

Atropos Atropos is a lightweight, free and open-source JavaScript library to create stunning touch-friendly 3D parallax hover effects. Available for J

Vladimir Kharlampidi 2.3k Jan 8, 2023