![]() |
VOOZH | about |
Bootstrap 5 Scrollspy is an automatic navigation mechanism that automatically updates the scroll position. When we click on the link it automatically scrolls down to the currently active element.
Bootstrap 5 Scrollspy Options: Scrollspy options can be through data attributes or via JavaScript code. We need to append the option name with 'data-bs-' to pass through the data attributes as shown in the example.
Example 1: In this example, we will demonstrate scrollspy options like offset, and target passing through data attributes.
Output:
Example 2: In this example, we will demonstrate the scrollspy options via JavaScript.
Output:
Reference:https://getbootstrap.com/docs/5.0/components/scrollspy/#options