Coder Social home page Coder Social logo

lucien144 / vue3-parallaxy Goto Github PK

View Code? Open in Web Editor NEW
20.0 1.0 0.0 6.94 MB

๐Ÿ’ฅ Lightweight yet powerful parallax component for Vue3 with breakpoints option and animation callback. Nuxt3 ready.

Home Page: https://parallaxy.144.wtf/

License: MIT License

JavaScript 5.75% HTML 18.94% Vue 64.42% SCSS 0.24% TypeScript 6.28% CSS 4.37%
parallax vue vue-plugin vue3 vue3-plugin vuejs3 parallax-effect parallax-scrolling nuxt nuxt3

vue3-parallaxy's Introduction

Parallaxy

๐Ÿ’ฅ Lightweight yet powerful parallax component for Vue3 with breakpoints option and animation callback. Nuxt3 ready.


๐Ÿ‘‰ Examples and usage here. ๐Ÿ‘ˆ


Installation

npm i @lucien144/vue3-parallaxy
# yarn add @lucien144/vue3-parallaxy

Usage

<template>
	<Parallaxy :speed="20" :animation="(delta: number) => `transform: translate3d(0, ${delta}px, 0);`">
		<img src="https://picsum.photos/400">
	</Parallaxy>
</template>

<script setup lang="ts">
import Parallaxy from '@lucien144/vue3-parallaxy';
</script>

Props

Props Type Default / Options Description
axis string y / y, x Axis of the movement.
speed number 50 Speed of the movement. Higher number -> faster. Negative values changes the direction.
direction string normal / normal, opposite Direction of the movement. normal -> up on y axis etc.
breakpoints object undefined / {[breakpoint: number]: {ParallaxyOptions}} You can specify all props for different breakpoints. If window width >= breakpoint then the settings is applied, zero breakpoint is the default settings. See the Example 5.
animation Function (delta: string) => ... Custom CSS style animation where delta is the position offset of the element relative to the bottom of the viewport.
(delta: string) => transform: translate3d(0, ${delta.value}px, 0); For the y axis.
(delta: string) => transform: translate3d(${delta.value}px, 0, 0); For the x axis.
disabled boolean false Enable / disable the parallax effect.
debug boolean false Show the debug panel.

Few notes under the line

  • When using custom animations, always work with transform: translate3d(0, 0, 0) to turn on the GPU acceleration.
  • Keep in mind that moving element may run out of it's bounding box, thus, use overflow: hidden as much as you can.

vue3-parallaxy's People

Contributors

lucien144 avatar

Stargazers

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

Watchers

 avatar

vue3-parallaxy's Issues

Nuxt3

Is there a way to install it on nuxt3? Make it global and not need to import all components?

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.