A lightweight Vue component for scroll-based menu highlighting and smooth scrolling to sections. Current stable version is 0.9.3, released on npm. It automatically adds an 'active' class to menu items as corresponding sections come into view, and scrolls to the target section on click. Key differentiators: supports both href-based and custom data attribute selectors, configurable easing and offset, emits itemchanged events, and allows dynamic menu items. Compared to alternatives like vue-scrollspy or vue-scrollto, this component combines scrollspy and scroll-to behavior in one package with a simple plugin API. Works with Vue 2 only (no Vue 3 support). Dependencies: requires Promise polyfill for older browsers.
npm install vue-scrollactiveNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to install, register the plugin, and use the scrollactive component with anchor-based menu items.
Review the changelog for v0.9.0; update props like offset, duration, or bezier-easing-value if needed.
If using Vue 3, consider alternatives like vue-scrollto or vue3-scroll-spy.
Install a polyfill like promise-polyfill: npm install promise-polyfill and include it before vue-scrollactive.
Ensure each menu item has class="scrollactive-item" (or :class="['scrollactive-item']").
Prefer href attribute with valid ID selectors unless you need CSS selector flexibility.
Ensure you call Vue.use(VueScrollactive) after importing the package: import VueScrollactive from 'vue-scrollactive'; Vue.use(VueScrollactive);
Make sure Vue is imported before VueScrollactive. Example: import Vue from 'vue' first.
Add a Promise polyfill before loading vue-scrollactive: <script src="https://cdn.jsdelivr.net/npm/promise-polyfill/dist/polyfill.min.js"></script>
Register the plugin with Vue.use(VueScrollactive) and ensure your build tool handles the package correctly.