Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AndersDJohnson/anchorate
Scroll to anchor links.
https://github.com/AndersDJohnson/anchorate
Last synced: 15 days ago
JSON representation
Scroll to anchor links.
- Host: GitHub
- URL: https://github.com/AndersDJohnson/anchorate
- Owner: AndersDJohnson
- License: isc
- Created: 2016-06-12T17:11:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:43:59.000Z (almost 2 years ago)
- Last Synced: 2024-09-19T17:18:03.862Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://andersdjohnson.github.io/anchorate/
- Size: 521 KB
- Stars: 28
- Watchers: 4
- Forks: 3
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# anchorate
> Scroll to anchor links.
[:book: Read the docs!](https://andersdjohnson.github.io/anchorate/)
Scroll to anchor links with client-side routes e.g. with [history]'s `listen`, [React Router]'s `onUpdate`, or [Gatsby]'s `onRouteChange`.
Register a listener to call this and when `window.location.hash` isn't empty,
it'll [scrollIntoView] first matching element by `id` or `name` per [spec].Originally based on: [https://github.com/reactjs/react-router/issues/394#issuecomment-220221604](https://github.com/reactjs/react-router/issues/394#issuecomment-220221604).
## Used By
* [Formidable Labs Spectacle Docs](https://formidable.com/open-source/spectacle/)
* [Formidable Labs Victory Docs](https://formidable.com/open-source/victory/)
* [Formidable Labs Renature Docs](https://formidable.com/open-source/renature/)
* [Full Stack Open 2019](https://fullstackopen.com/)
* [Kyma](https://kyma-project.io/)
* [LessWrong](https://www.lesswrong.com/)[react router]: https://github.com/reactjs/react-router
[history]: https://github.com/ReactJSTraining/history
[gatsby]: https://github.com/gatsbyjs/gatsby
[scrollIntoView]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
[spec]: https://www.w3.org/TR/html4/struct/links.html#h-12.1.3