Docs say:
To easily add scrollspy behavior to your topbar navigation, add
data-spy="scroll"
to the element you want to spy on ( most typically this would be the<body>
). Then add thedata-target
attribute with the ID or class of the parent element of any Bootstrap.nav
component.
The code you posted wasn't working because you were spying on #top-fixed-nav
(scroll events).