A Vue component that syncronize containers scroll positions
npm i --save vue-scroll-sync
Include the script file, then install the component with Vue.use(ScrollSync);
e.g.:
<script type="text/javascript" src="https://github.com/metawin-m/vue-scroll-sync/raw/master/node_modules/vue/dist/vue.min.js"></script>
<script type="text/javascript" src="https://github.com/metawin-m/vue-scroll-sync/raw/master/node_modules/vue-scroll-sync/dist/scroll-sync.min.js"></script>
<script type="text/javascript">
Vue.use(ScrollSync);
</script>
import ScrollSync from 'vue-scroll-sync';
Once installed, it can be used in a template as simply as:
<scroll-sync>
Content
</scroll-sync>
Create the plugins/vue-scroll-sync.js
:
import Vue from 'vue'
import ScrollSync from 'vue-scroll-sync'
Vue.component('scroll-sync', ScrollSync)
Include plugin in your nuxt.config.js
file:
module.exports = {
plugins: ['~plugins/vue-scroll-sync']
}
This project is licensed under the MIT License - see the LICENSE file for details