https://github.com/wuxianqiang/v-back
back to the top
https://github.com/wuxianqiang/v-back
backtop directive vue
Last synced: about 2 months ago
JSON representation
back to the top
- Host: GitHub
- URL: https://github.com/wuxianqiang/v-back
- Owner: wuxianqiang
- Created: 2019-05-01T00:23:12.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-03T07:50:57.000Z (about 7 years ago)
- Last Synced: 2025-09-21T14:59:42.796Z (9 months ago)
- Topics: backtop, directive, vue
- Language: JavaScript
- Homepage:
- Size: 94.7 KB
- Stars: 0
- Watchers: 0
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# v-back
back to the top
# Installation
## npm
```bash
$ npm i v-back -S
```
# Usage
main.js:
```javascript
import Vue from 'vue'
import App from './App.vue'
import VBack from 'v-back'
Vue.use(VBack)
// or with options
Vue.use(VBack, {
el: '#wrapper',
duration: 300
})
new Vue({
el: 'body',
components: {
App
}
})
```
template:
```html
top
```
> Scroll to the top 50
use `v-back` in the container
```
Vue.use(VBack, {
el: '#wrapper',
duration: 300,
distance: '50px'
})
```
## Constructor Options
|key|description|default|options|
|:---|---|---|---|
| `el`|scroll container|`window`|`String`|
|`duration`|Rolling time|`300`|`Number`|
|`distance`|When does the scrolling element appear?|Always appear|`String`|