Vue component, that helps to make sticky effects

Overview

vue-sticker

Vue component, that helps to make sticky effects

example

Build Status js-standard-style npm version

Installation

# install component
npm install --save-dev vue-sticker

using like local component

import VueSticker from 'vue-sticker'

...
    components: { VueSticker }

or use globally

import VueSticker from 'vue-sticker'
import Vue from 'Vue'

Vue.use(VueSticker)

Usage

After installing you can use vue-sticker component in your templates:

<VueSticker :d="300"></VueSticker>

Props description

prop name type description
d Number required It's diameter of your sticker (width and height of block)
className String This allows to you add styles to sticker by this name. For example: if you set className="good", then you can styling this sticker with .good__wrapper, .good__main-image and .good__backside-image. Your pictures has to be describe in these classes. By default className is set to 'vue-sticker'
prefix String that allows to you keep style guide and metodology, that you use in all your project. This string will be added between className and other words (elements). For example, you can set it in '--', and you get something like this: .goode--wrapper, .good--main-image and .good--backside-image. By default uses __
end Number/Boolean end point of sticky ability. This prop has to be > 0 and < d (size of your component)
deg Number this prop need to set degree that will be used when we active sticker by Enter key, without mouse cursor (Yes, i thought about accessibility). Also this prop uses for first animation helper (if you turn it on)
tipAnimation Boolean This prop turn on/off first animation, to indicate users, taht this element can sticky. (Indeed, i think about it case, may be it can be design by other way)

Describe your styles in component where you use vue-sticker by three elements: wrapper, main-image and backside-image.

Sass example with className="good"

Illustrate case when you set main-image, but backside is just color

<VueSticker :d="200" className="good" />
.good

    &__wrapper

        &:focus
            box-shadow: 0 0 5px 10px rgba(0, 0, 0, .4)

    &__main-image
        background-image: url('your-image.png')

    &__backside-image
        background-color: lighgray
        opacity: .4

CSS example with className="example" and prefix="--"

<VueSticker :d="200" className="example" prefix="--" />

In this case we skip wrapper just for example. Usually wrapper styles need to add :hover and :focus for your component. But it's not must have.

.example--main-image {
    background-image: url('example.png');
}

.example--backside-image {
    background-image: url('back.png');
}

getPercent event

Vue-sticker always generate event, that indicate number from 0 to 1 of sticky complition. When user get down of sticker it will be 1.

To handle this event you just need add your method in your parent component and subscribe on event getPercent in vue-sticker component.

<VueSticker :d="400" @getPercent="doSomething" />

And set your method in parent component, for example we use percent:

...
doSomething(value) {
    this.percentOfComplition = value * 100;
}

Backers

Maxim Chagin — 17$

You might also like...
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.

In this challenge, challenger have to make 50 little projects in 100 days.
In this challenge, challenger have to make 50 little projects in 100 days.

50projectsin100days { 50projectsin100days } is a software challenge. In this challenge, challenger have to make 50 little projects (ex. trivia app, pa

A beautiful chat rooms component made with Vue.js - compatible with Vue, React & Angular
A beautiful chat rooms component made with Vue.js - compatible with Vue, React & Angular

vue-advanced-chat Vue 3 compatibility 🚀 Features Vue, Angular & React compatibility Customizeable realtime chat messaging Backend agnostic Images, vi

Vue 3 + Vite - How to use vue Teleport component

Vue 3 + Vite - How to use vue Teleport component

Vue Cookies Consent - Nice and clean component to display message about cookies in Vue and Nuxt.js

Vue Cookies Consent Nice and clean component to display message about cookies in Vue and Nuxt.js 🎬 Demo 📦 Installation NPM npm install --save @norvi

Vue-slot-portal - Vue plugin for across-component slot distribution
Vue-slot-portal - Vue plugin for across-component slot distribution

vue-slot-portal Vue plugin for across-component slot distribution. install npm i vue-slot-portal usage define slot routes (key: slotName, value: compo

Vue-easy-print: This is a vue.js-based printing component
Vue-easy-print: This is a vue.js-based printing component

这是一个基于vue 2.0的打印组件 中文文档 English 核心: 使用vue组件的slot插槽进行模板加载。

An avatar component for vue.js

vue-avatar An avatar component for vue.js. This component display an avatar image and if none is provided fallback to the user initials. This componen

Vue component that simulates a user typing, selecting, and erasing text.

Vue component that simulates a user typing, selecting, and erasing text. Play with vue-typer in this interactive demo. Getting Started Usage Props tex

Comments
  • Lib not mified

    Lib not mified

    Hello! Thanx for component.

    Would you minified vue-sticker.min.js in dist folder. Postfix "min" is, but content of file non minified.

    I hope, you will fixed it. Thank you!

    help wanted good first issue 
    opened by nanomen 1
Owner
Kamil
I am fond of JS. Now live in Moscow, Russian Federation. Glad to see new friends =)
Kamil
A bursting particles effects buttons component ✨💥❄️🌋

vue-particle-effect-buttons (demo) Bursting particle effect buttons for Vue. This library is a Vue portal of an awesome Codrops Article by Luis Manuel

Vincent Guo 252 Nov 11, 2022
🖱 An animated custom cursor effects for interactive elements like navigation - w/ VueJS - SSR Compatible

?? Vue Cursor Fx An animated custom cursor effects for interactive elements like navigation - w/ VueJS - SSR Compatible Installation This package is a

Luca Iaconelli 56 Aug 18, 2022
Vue.js 2.x plugin that helps to use id-related attributes with no side-effect

VueUniqIds A Vue.js plugin that helps to use id-related attributes with no side-effect It is a trend to use components. Components are cool, they are

Stanislav Termosa 33 Oct 6, 2022
Webact is a tiny library that helps you create web components in a manner similar to Vue and React.

?? Webact ?? Webact is a tiny library that helps you create web components in a manner similar to Vue and React. Without the need for heavy tools like

Jeremy Karlsson 2 Jan 5, 2022
A Vue.js directive helps track visible elements.

vue-visibility-track A Vue.js directive helps track elements's visibility. Installing Using npm: npm install --save vue-visibility-track Using yarn: y

Xiaolin Wu 0 Mar 26, 2021
OSI helps you to track your all open-source Internships and Program in a single place ⚡

OSI helps you to track your all open-source Internships and Program in a single place ⚡

Rohan kumar 39 Jan 2, 2023
Plugin helps to add resize params like width, height etc. to image url

Plugin helps to add resize params like width, height etc. to image url. Compatible with Vue 3.x. NOTE: Plugin doesn't resize image. Plugin only helps to format url to resize server with comfortable way.

Pavel Kurapov 0 Jul 14, 2021
Fast and lightweight library helps you to update js objects without mutating them

immhelper Fast and lightweight library helps you to update js objects without mutating them Install with npm npm install immhelper --save Features Ex

null 17 Apr 25, 2022
Vue Component to Make Google Material Design Ripple Effect. http://bosnaufal.github.io/vue-ripple/

Vue Ripple Vue Component to Make Google Material Design Ripple Effect. It's adopted from angular-ripple DEMO Install You can import vue-ripple to your

Naufal Rabbani 50 Sep 29, 2022