This project demonstrates an automatic table of contents (TOC) generator for HTML documents using JavaScript. It highlights the current section of the document as you scroll and allows smooth navigation to different sections by clicking the TOC items.
<h1>, <h2>, etc.) in your document.You can try out a live demo of the project here: Live Demo
Clone the repository:
git clone https://github.com/BaseMax/document-auto-scroll-javascript.git
cd document-auto-scroll-javascript
Then open the document.html file in a browser:
open document.html
Or simply deploy it to any web server or local environment that supports HTML and JavaScript.
This project uses the Intersection Observer API, which is supported in most modern browsers (Chrome, Firefox, Edge, and Safari). For older browsers, consider adding a polyfill.
Contributions are welcome! Feel free to submit a pull request or open an issue for any bugs or feature requests.
This project is licensed under the GPL-3.0 License. See the LICENSE file for details.
This is open-source so feel free to customize it to fit for your project!
Copyright 2024, Max Base