# micro-scrollspy

> A lightweight library for implementing scrollspy functionality in web applications.

Latest version **0.0.1** (published 2024-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install micro-scrollspy
pnpm add micro-scrollspy
yarn add micro-scrollspy
bun add micro-scrollspy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2024-03-12 |
| First published | 2024-03-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Oleg Vitrovich |
| Maintainers | rosalinbat |
| Keywords | scrollspy, scroll, navigation, spy, scroll-tracker |

## Links

- npm: https://www.npmjs.com/package/micro-scrollspy
- Repository: https://github.com/rosalinbat/micro-scrollspy
- Homepage: https://github.com/rosalinbat/micro-scrollspy#readme
- Issues: https://github.com/rosalinbat/micro-scrollspy/issues
- npm.io page: https://npm.io/package/micro-scrollspy

## Dependencies (5)

- [delegate](https://npm.io/package/delegate.md) ^4.1.2
- [scrollama](https://npm.io/package/scrollama.md) ^2.2.3
- [lodash.throttle](https://npm.io/package/lodash.throttle.md) ^4.1.1
- [intersection-observer](https://npm.io/package/intersection-observer.md) ^0.12.0
- [smoothscroll-polyfill](https://npm.io/package/smoothscroll-polyfill.md) ^0.4.4

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2024-03-12

## README

# Micro ScrollSpy

A lightweight library for adding scrollspy functionality to your web pages. Automatically updates navigation links based on scroll position.

## Features

- Easy to use and integrate
- Utilizes IntersectionObserver for performance
- Smooth scroll implementation
- Throttled scroll events for better performance
- Dependency on modern and efficient libraries

## Installation

```
npm install micro-scrollspy
```

## Usage

First, include the library in your project:

```javascript
import LightweightScrollSpy from 'micro-scrollspy';
```

Then, initialize the library with your configuration:

```javascript
new LightweightScrollSpy({
sections: '.section-class', // Class of the sections to spy on
navLinks: 'nav a', // Selector for navigation links
activeClass: '.active', // Class to add/remove on navigation
offset: 0.4, // Scroll offset for activation
});
```

## Dependencies

- `scrollama` for handling scroll events
- `intersection-observer` as a polyfill for better browser support
- `lodash.throttle` to throttle scroll events for performance
- `smoothscroll-polyfill` to enable smooth scrolling in all browsers
- `delegate` for easy event delegation

## Contributing

Contributions are welcome! Please submit a pull request or create an issue for any features or bug fixes.

## License

MIT

---
_Source: https://npm.io/package/micro-scrollspy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
