ScrollSpy not working, need help

Hello,

New to programming and I’m working on the portfolio project. I can’t seem to get the Scrollspy to work. Like other’s I’ve tried google searches, and also looking on this forum but I haven’t been able to solve the problem for my code.

Here is my codepen, I apologize for the messy code and it is also not mobile friendly yet so it needs to be seen on a desktop screen.

codepen.io /JohnSpahn/pen/gXXWQV

Thank you!

Change your data-target to an id on the nav tag.
Add nav-link and nav-item classes to your links on the nav.
Just follow the documentation: https://getbootstrap.com/docs/4.0/components/scrollspy/

Thanks for the prompt response. So I was trying that earlier, and I just added the nav-item and nav-link’s back with an #id on my navbar and it still is not highlighting.

Nevermind, I figured it out. Thanks!

1 Like

Hi,

Try to use the body tag with data-target=".navbar" and check