Sometimes while designing the website, we include some attractive features which make the website eye-catching. One of the features is Bootstrap Scrollspy which targets the navigation bar contents automatically on scrolling the area.
Some attributes are added with the elements for the implementation of this feature. These are:
data-spy It is an attribute that is to be added with the element which is used as the scrollable area (in the above example we are taking it as the body). The value of data-spy is scroll.
data-target This attribute is used to connect the navigation bar with the scrollable area. It takes the value as the name of the ID or class of the navigation bar.
data-offset This attribute specifies the number of pixels to offset from the top when calculating the position of the scroll.