I am trying to create a scrollspy using bootstrap5.3. I am following the BS5 example to create the html page with the link below.
https://stackblitz.com/edit/web-platform-phnijx?file=index.html
The are two issues with my current code:
- the scrollspy highlight 'B'
- the scrollspy doesn't work after you scroll down once. If you scroll up, it won't highlight the corresponding fields
Any suggestions would be great.
Thank you in advance!
I tried to isolate the code into minimal snippet and follow the BS5 examples.
I am expecting it works as a scrollspy with navbar:
It's a problem from Bootstrap's side. As this same exact issue was reported on GitHub. Unfortunately, this problem is reported since May 24, 2022 and it's not fixed yet. Even Bootstrap's official site had a similar issue.
Quoting from a member of the Bootstrap core team:
In the meantime, either revert to an older version (anything less than
5.2like5.1or5), or you can actually use a workaround but none of the workarounds worked for me.