ScrollSpy not working, need help

ScrollSpy not working, need help
0.0 0

#1

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!


#2

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/


#3

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.


#4

Nevermind, I figured it out. Thanks!


#5

Hi,

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