ibufu / vue2-scrollspy

Scrollspy for Vue2
https://ibufu.github.io/vue2-scrollspy/
MIT License
135 stars 32 forks source link

feat: support specify scroll container #12

Open Yuliang-Lee opened 6 years ago

Yuliang-Lee commented 6 years ago

support instead listen window's scroll event but listen specific dom's scroll event

ibufu commented 6 years ago

If you want to set something else (not body) to scroll container, you could:

<div class="container" v-scroll-spy>
    <div>
        <h1>Header 1</h1>
        <p>Content</p>
    </div>
    <div>
        <h1>Header 2</h1>
        <p>Content</p>
    </div>
</div>
.container {
  position: relative;
}