GithubHelp home page GithubHelp logo

croutonn / vue-rellax Goto Github PK

View Code? Open in Web Editor NEW
42.0 1.0 8.0 561 KB

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

License: MIT License

JavaScript 56.75% TypeScript 43.25%
vue parallax

vue-rellax's Introduction

vue-rellax

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

Getting Started

Install

npm i vue-rellax -S

or

yarn add vue-rellax

Browser Support

Since this plugin uses WeakMap, old browsers need to load pollyfill.

<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?features=WeakMap"></script>

Usage

import Vue from 'vue'
import VueRellax from 'vue-rellax'

Vue.use(VueRellax)

const vm = new Vue({
  el: '#app',
  template: `
    <div v-rellax="{
      // Rellax Options
      // See: https://github.com/dixonandmoe/rellax#features
      speed: -2,
    }">
      I’m slow and smooth
    </div>
  `
})

Configure rellax defaults in a component's data object:

data() {
  return {
    rellax: {
      speed: -2
    }
  }
}

Destroy

To destroy, assign false to v-relax.

const vm = new Vue({
  el: '#app',
  template: `
    <div>
      <p v-rellax="rellax">
        I’m slow and smooth
      </p>
      <button type="button" @click="destroyRellax">Destroy Rellax</button>
    </div>
  `,
  data() {
    return {
      rellax: {
        speed: -2
      }
    }
  },
  methods: {
    destroyRellax() {
      this.rellax = false
    }
  }
})

For Nuxt.js

In your nuxt.config.js

{
  plugins: [
    { src: '~~/node_modules/vue-rellax/lib/nuxt-plugin', ssr: false }
  ]
}

vue-rellax's People

Contributors

croutonn avatar dependabot[bot] avatar mktcode avatar mmeester avatar renovate-bot avatar yutahaga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vue-rellax's Issues

Should "percentage" work with this implementation ?

Hi guys !
I sucessfully managed to use the speed parameter, but "percentage" doesn't seem to work, it this functionality implemented ?
I'm trying to use is like this :
<div class="container" v-rellax="{ speed: -5, percentage: 0.5 }">
Cheers and thanks !

expose refresh method

is there a way to call .refresh()?

in my case rellax seems to init too early, although images are loaded, transform calculation are messed up. it works after a window resize, so i'd like to call .refresh, after my view is fully rendered.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (@typehut:maintenance)

Rellax `wrapper` property

Does this plugin support the wrapper property of Rellax? I tried it but it seems it breaks the functioning of the plugin, the translates of elements do not update

How to load vue-rellax after page is rendered?

Hi,

I have like 25+ images (from api get method) in a v-for, I want to load rellax after the entire page is loaded.

When i scroll to the bottom, the images are all messed up in position. any way i can make the parallax start only when its visible in the screen after scroll?

Thanks!

relax != rellax

Sorry for the noize, thanks for this plugin ;)
you can close my 2 issues 💃

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.