Vue plugin - vue-scroll-to

0 votes
added Jun 14, 2018 in Vue by LC Marshal Captain (25,790 points)
npm install --save vue-scrollto //or
yarn add vue-scrollto
//As a vue directive (main.js)
var Vue = require('vue');
var VueScrollTo = require('vue-scrollto');
// You can also pass in the default options
Vue.use(VueScrollTo, {
     container: "body",
     duration: 500,
     easing: "ease",
     offset: 0,
     cancelable: true,
     onStart: false,
     onDone: false,
     onCancel: false,
     x: false,
     y: true
<!--Usage HTML-->
<a href="#" v-scroll-to="'#element'">Scroll to #element</a>
<div id="element">
    Hi. I'm #element.
<!--If you need to customize the scrolling options, you can pass in an object literal to the directive:-->
<a href="#" v-scroll-to="{
     el: '#element',
     container: '#container',
     duration: 500,
     easing: 'linear',
     offset: -200,
     cancelable: true
     onStart: onStart,
     onDone: onDone,
     onCancel: onCancel,
     x: false,
     y: true
    Scroll to #element
</a> - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.