Help Implementing Scroll Spy from Bootstrap

Help Implementing Scroll Spy from Bootstrap


Hi I’m trying to implement scroll spy in my pen. FYI, I’m building the personal portolio page.

Here’s the page I’m trying to build:
What I’ve done so far and where scroll spy needs to be implemented:



Sorry for late reply, I have been working on a job for someone. You need to add the data-spy='scroll' data-target='.navbar' to the body not the container you have it on, and it should work.


Sorry if I sound dumb, but I think we don’t have access to the body tag in codepen. That’s why I used it on the container.


CodePen discourages the use of the body tag, because they automatically put your code in a hidden body tag. However it is completely possible to add a body tag, I did so, and it worked.


Thanks so much, Sir. It worked like a charm. Makes me so proud to see everything like it should be. Thanks again. I would be posting it in the forums to get reviews, please do give your review as well.