GithubHelp home page GithubHelp logo

hhy5277 / vue-parallax Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apertureless/vue-parallax

0.0 1.0 0.0 671 KB

๐ŸŒŒ Vue.js component for parallax image scroll effects

License: MIT License

JavaScript 78.58% HTML 0.79% Vue 20.63%

vue-parallax's Introduction

vue-parallaxy

npm version vue2 license

Is a compontent for fast 60fps parallax scroll effects in vue 2.

Demo

Demo here

Install

npm install vue-parallaxy or yarn add vue-parallaxy

Usage

vue-parallax works with slots. So you can pass an image or even srcsets for better mobile experiences.

// Image.vue

<template>
  <parallax>
    <img src="path/cool-background-image.jpg" alt="very cool bg">
  </parallax>
</template>

<script>
  import Parallax from 'vue-parallaxy'
  export default {
    components: {
      Parallax
    }
  }
</script>

Props

Prop Type Default Value Description
parallax Boolean true Activates parallax effect
speedFactor Number 0.15 factor on how strong the effect is
direction String 'up' Either 'up' or 'down', determines scroll direction of image
fixed Boolean false Other parallax effect. Image is fixed in position
sectionHeight Number 70 section height for mobile
breakpoint String '(min-width: 968px)' Media query for mobile deactivation
sectionClass String 'Masthead' CSS class of the outer section tag
containerClass String 'Masthead__image' CSS class of the container holding the image
parallaxClass String 'is-parallax' Modifier class for the parallax effect
fixedClass String 'is-fixed' Modifier class for the fixed parallax effect

Customizing

You can change some of the behavior by changing the css classes. To be more clean, you can change them over the props. No need to overwrite or !important the existing classes.

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# run unit tests
npm run unit

# run all tests
npm test

For detailed explanation on how things work, checkout the guide and docs for vue-loader.

Contributing

  1. Fork it ( https://github.com/apertureless/vue-parallax/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

This software is distributed under MIT license.

vue-parallax's People

Contributors

apertureless avatar ikbelkirasan avatar

Watchers

 avatar

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.