![]() |
VOOZH | about |
Bootstrap5 Scrollspy Methods are used to control the Scrollspy element with the help of Javascript and perform operations like disposing of, getting or creating the Scrollspy instance, refreshing the element, etc along with finding out useful data about the widget within Javascript.
Bootstrap 5 Scrollspy getInstance() Method
Syntax:
bootstrap.Scrollspy.getInstance(scrollspy-element)Example 1: The code demonstrates how to implement the usage of the getInstance() Method using JavaScript on a Scrollspy with a navbar:
Output:
Example 2: The code demonstrates how to implement the usage of the getInstance() Method using JavaScript on a Scrollspy in a Nested Side Navbar:
Output:
Reference: https://getbootstrap.com/docs/5.0/components/scrollspy/#getinstance