it's a vuejs version of smoothscroll Based on https://github.com/alicelieutier/smoothScroll/blob/master/smoothscroll.js
# install dependencies
npm install vue-smoothscroll
then in the js file , you can use with router or others
var vueSmoothScroll = require('vue-smoothscroll');
Vue.use(vueSmoothScroll);
//define a tag
<div v-smoothscroll="{ duration : 500, callback: callback , context : undefined , axis :'y' }" class="message">
message
</div>
or
this.$SmoothScroll(target,duration,callback,context,axis);
params
target
is aHTMLElement Object
from your document that you want to scroll to, or a numeric position on the pageduration
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 anyHTMLElement Object
)axis
is the x,y axis ,the value can be 'y' , 'x' , 'both', 'y' means horizontal direction, 'x' means vertical direction