Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Teddy-Zhu/vue-smoothscroll

a vue version smoothscroll for website
https://github.com/Teddy-Zhu/vue-smoothscroll

Last synced: 13 days ago
JSON representation

a vue version smoothscroll for website

Awesome Lists containing this project

README

        

# vue-smoothscroll

> it's a vuejs version of smoothscroll Based on https://github.com/alicelieutier/smoothScroll/blob/master/smoothscroll.js

## How to Use

``` bash
# install dependencies
npm install vue-smoothscroll
```
then in the js file , you can use with router or others
``` javascript
var vueSmoothScroll = require('vue-smoothscroll');
Vue.use(vueSmoothScroll);

```

```html
//define a tag


message

```

or

```javascript
this.$SmoothScroll(target,duration,callback,context,axis);
```
params
* `target` is a `HTMLElement Object` from your document that you want to scroll to, or a numeric position on the page
* `duration` is the total duration of the scroll (optional, defaults to 500ms)
* `callback` is a function to be executed when the scrolling is over (optional)
* `context` is the scrolling context (optional, defaults to window, can be any `HTMLElement Object`)
* `axis` is the x,y axis ,the value can be 'y' , 'x' , 'both', 'y' means horizontal direction, 'x' means vertical direction