0.1.1 • Published 5 years ago

v-scrollspy v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

v-scrollspy

A Vue scrollspy directive using the Intersection Observer API.

It's a thin wrapper of @jfm/scrollspy library.

Install

npm install v-scrollspy

Usage

<template>
  <main>
    <section id="1" v-scrollspy="onScrollTo">
      <h1>1</h1>
      <p>...</p>
    </section>

    <section id="2" v-scrollspy="onScrollTo">
      <h1>2</h1>
      <p>...</p>
    </section>

    <section id="3" v-scrollspy="onScrollTo">
      <h1>3</h1>
      <p>...</p>
    </section>
  </main>
</template>

<script>
import scrollspy from 'v-scrollspy'

export default {
  directives: { scrollspy },

  data: () => ({
    active: ''
  }),

  methods: {
    onScrollTo(el) {
      this.active = el.id
    }
  }
}
</script>

License

MIT

0.1.1

5 years ago

0.1.0

5 years ago

0.0.0

5 years ago