Bootstrap 4 Components

Scrollspy

The Scrollspy plugin is used to update the navigation targets based on the current scroll position.

The element you are spying upon requires position: relative in order for scrollspy to work.

To spy upon an element using your navigation, add data-spy=”scroll” to it. Then add data-target attribute with an ID of the parent element of any bootstrap .nav component.