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

a vue version smoothscroll for website

License

Notifications You must be signed in to change notification settings

Teddy-Zhu/vue-smoothscroll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

a vue version smoothscroll for website

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published