Skip to content
This repository has been archived by the owner on Apr 10, 2019. It is now read-only.

Latest commit

 

History

History
35 lines (28 loc) · 1.12 KB

README.md

File metadata and controls

35 lines (28 loc) · 1.12 KB

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-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 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