0.2.0 • Published 7 years ago
vue-smoothscroll v0.2.0
vue-smoothscroll
it's a vuejs version of smoothscroll Based on https://github.com/alicelieutier/smoothScroll/blob/master/smoothscroll.js
How to Use
# install dependencies
npm install vue-smoothscrollthen 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
targetis aHTMLElement Objectfrom your document that you want to scroll to, or a numeric position on the pagedurationis the total duration of the scroll (optional, defaults to 500ms)callbackis a function to be executed when the scrolling is over (optional)contextis the scrolling context (optional, defaults to window, can be anyHTMLElement Object)axisis the x,y axis ,the value can be 'y' , 'x' , 'both', 'y' means horizontal direction, 'x' means vertical direction