{"id":19382460,"url":"https://github.com/bennyxguo/vue3-scroll-spy","last_synced_at":"2026-02-28T19:32:13.630Z","repository":{"id":65412491,"uuid":"342648696","full_name":"bennyxguo/vue3-scroll-spy","owner":"bennyxguo","description":"A vue3 directive for scroll menu tracking.","archived":false,"fork":false,"pushed_at":"2023-04-11T13:37:59.000Z","size":1748,"stargazers_count":26,"open_issues_count":5,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-20T02:22:20.275Z","etag":null,"topics":["menu","scroll","scrollspy","vue3","vue3-typescript"],"latest_commit_sha":null,"homepage":"https://gh.bennyxguo.com/vue3-scroll-spy/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bennyxguo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-26T17:23:12.000Z","updated_at":"2025-06-25T11:24:48.000Z","dependencies_parsed_at":"2024-06-18T18:07:58.013Z","dependency_job_id":"67e3c87b-1dd7-498d-b7d9-c3ba886783ff","html_url":"https://github.com/bennyxguo/vue3-scroll-spy","commit_stats":null,"previous_names":["tridiamond/vue3-scroll-spy","tridiamond/vue3-scrollspy"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bennyxguo/vue3-scroll-spy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennyxguo%2Fvue3-scroll-spy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennyxguo%2Fvue3-scroll-spy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennyxguo%2Fvue3-scroll-spy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennyxguo%2Fvue3-scroll-spy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bennyxguo","download_url":"https://codeload.github.com/bennyxguo/vue3-scroll-spy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennyxguo%2Fvue3-scroll-spy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29948870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T18:42:55.706Z","status":"ssl_error","status_checked_at":"2026-02-28T18:42:48.811Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["menu","scroll","scrollspy","vue3","vue3-typescript"],"created_at":"2024-11-10T09:21:30.112Z","updated_at":"2026-02-28T19:32:13.607Z","avatar_url":"https://github.com/bennyxguo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://bennyxguo.me\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg width=\"100\" src=\"https://img-blog.csdnimg.cn/20200930013332450.png\" alt=\"bennyxguo logo\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eVue3 Scroll-Spy Directive\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cp\u003eScrollspy and animated scroll-to for Vue3, inspired by \u003ca href=\"https://github.com/ibufu/vue2-scrollspy\"\u003evue2-scrollspy\u003c/a\u003e. \u003cbr\u003e\n  —— Made with ❤️ by \u003ca href=\"https://github.com/bennyxguo\"\u003eBenny Guo\u003c/a\u003e\u003c/p\u003e\n\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/bennyxguo/vue3-scroll-spy/stargazers\"\u003e\n      \u003cimg src=\"https://img.shields.io/github/stars/bennyxguo/vue3-scroll-spy.svg\" alt=\"Github starts\"\u003e\n    \u003c/a\u003e\n    \u003ca\u003e\n      \u003cimg src=\"https://img.shields.io/github/license/bennyxguo/vue3-scroll-spy.svg\" alt=\"License\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/vue3-scroll-spy\"\u003e\n      \u003cimg src=\"https://img.shields.io/npm/dt/vue3-scroll-spy.svg\" alt=\"Npm downloads\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/vue3-scroll-spy\"\u003e\n      \u003cimg src=\"https://img.shields.io/bundlephobia/minzip/vue3-scroll-spy.svg\" alt=\"npm bundle size (minified + gzip)\"\u003e\n    \u003c/a\u003e\n    \u003ca\u003e\n      \u003cimg src=\"https://img.shields.io/npm/v/vue3-scroll-spy.svg\" alt=\"Npm version\"\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\n[｜ 📙 中文文档](https://github.com/bennyxguo/vue3-scroll-spy/blob/master/README_CN.md)\n[｜ 📙 Changelog](https://github.com/bennyxguo/vue3-scroll-spy/blob/master/CHANGELOG.md)\n\n\u003c/div\u003e\n\n## Installation\n\n```bash\nnpm i vue3-scroll-spy -S\n```\n\nOR\n\n```bash\nyarn add vue3-scroll-spy\n```\n\n## Usage\n\n### Support\n\n| Supported Package | Version |\n| ----------------- | ------- |\n| Vue               | 3+      |\n\n### Install Directive\n\n```javascript\n// global register at main.js\nimport { registerScrollSpy } from 'vue3-scroll-spy';\n\nconst app = createApp(App)\n// Using default options\nregisterScrollSpy(app)\n\n// or custom global options\nregisterScrollSpy(app, options)\n\napp.mount('#app')\n```\n\n### On template\n\n```html\n\u003cul v-scroll-spy-active v-scroll-spy-link\u003e\n  \u003cli\u003e\n    \u003ca\u003eMenu 1\u003c/a\u003e\n  \u003c/li\u003e\n  \u003cli\u003e\n    \u003ca\u003eMenu 2\u003c/a\u003e\n  \u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cdiv v-scroll-spy\u003e\n  \u003cdiv\u003e\n    \u003ch1\u003eHeader 1\u003c/h1\u003e\n    \u003cp\u003eContent\u003c/p\u003e\n  \u003c/div\u003e\n  \u003cdiv\u003e\n    \u003ch1\u003eHeader 2\u003c/h1\u003e\n    \u003cp\u003eContent\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n```\n\n## Configuration\n\n### v-scroll-spy\n\nBinding scroll-spy to sections (or elements) of a container.\n\n| Directive name                          | Description                                                                     | Default                                    |\n| --------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------ |\n| `v-scroll-spy=\"{allowNoActive: true}\"`  | When scroll position is outside of the container, active class will be removed. | Keep one section stays active at all time. |\n| `v-scroll-spy=\"{offset: 50}\"`           | TAdding offset to scroll and active elements.                                   | Default: `0`                               |\n| `v-scroll-spy=\"{time: 200, steps: 30}\"` | Set the animation options, time is animation duration, steps is step per frame. | `{time: 200, steps: 30}`                   |\n\n### v-scroll-spy-active\n\nSetting active elements' `selector` and `class` properties.\n\n| Directive name                                                             | Description                                 | Default                             |\n| -------------------------------------------------------------------------- | ------------------------------------------- | ----------------------------------- |\n| `v-scroll-spy-active=\"{selector: 'li.menu-item', class: 'custom-active'}\"` | Customize elements selector and class name. | `{selector: null, class: 'active'}` |\n\n### v-scroll-spy-link\n\nAdd `click handler` on children elements allow scrolling to the related section.\n\n| Directive name                                  | Description                    | Default                             |\n| ----------------------------------------------- | ------------------------------ | ----------------------------------- |\n| `v-scroll-spy-link=\"{selector: 'a.menu-link'}\"` | Customize menu links selector. | `{selector: null, class: 'active'}` |\n\n### Bezier animations\n\n```javascript\nimport { registerScrollSpy, Easing } from '@/directives/ScrollSpy'\n\nconst app = createApp(App)\n\n// or custom global options\nregisterScrollSpy(app, {\n  easing: Easing.Cubic.In\n})\n\napp.mount('#app')\n```\n\n## Note\n\n- You should have the same number of children elements for `v-scroll-spy`, `v-scroll-spy-active`, `v-scroll-spy-link` for this directive to work correctly.\n- If you need to share this scroll-spy directive on multiple containers, you can add `data-scroll-spy-id=\"\"` on each element container, where this directive is bind.\n\n### Nested sections\n\nVue3 Scroll-Spy also support multi-leveled sections:\n\n```html\n\u003col\n  v-scroll-spy\n  v-scroll-spy-active=\"{selector: 'li.menu-item', class: 'active'}\"\n\u003e\n  \u003cli class=\"menu-item\"\u003eItem 1\u003c/li\u003e\n  \u003cli class=\"menu-item\"\u003e\n    Item 2\n    \u003col\u003e\n      \u003cli class=\"menu-item\"\u003eItem 2.1\u003c/li\u003e\n      \u003cli class=\"menu-item\"\u003eItem 2.2\u003c/li\u003e\n    \u003c/ol\u003e\n  \u003c/li\u003e\n\u003c/ol\u003e\n```\n\n## Liscense\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbennyxguo%2Fvue3-scroll-spy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbennyxguo%2Fvue3-scroll-spy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbennyxguo%2Fvue3-scroll-spy/lists"}