https://github.com/imarc/v-scroll-sync
https://github.com/imarc/v-scroll-sync
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/imarc/v-scroll-sync
- Owner: imarc
- Created: 2019-12-17T16:46:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-07T14:19:50.000Z (about 6 years ago)
- Last Synced: 2024-12-05T09:14:19.679Z (over 1 year ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 6
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
v-scroll-sync
=============
v-scroll-sync is a vue directive, `v-scroll-sync`, that lets you keep the
scroll positions of multiple elements in sync.
Getting Started
---------------
Install via NPM (or yarn or such):
```
$ npm install v-scroll-sync
```
Import it in your code (or `require` it):
```
import Vue from 'vue';
import VScrollSync from 'v-scroll-sync';
Vue.use(VScrollSync);
```
Usage
-----
The most basic usage is like this:
```
...
...
```
If you add this on two scroll elements, it'll keep the percentage scrolled in
each direction in sync across all elements with this directive.
You can optionally specify name the group, in case you need multiple groups:
```
...
...
...
...
```
The directive also supports two modifiers, `.x` and `.y`, which can be used to
only synchronize scrollLeft or scrollTop respectively:
```
...
...
```
Lastly, if you want to do something totally custom, you can set the directive's
value to your own function:
```
...
...
```