Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
Bootstrap 5, same code not working in my local but works in codeply

I am trying to reproduce this scrollspy example from bootstrap website.

Here is how I reproduce it: https://yue-site-front.herokuapp.com/ You can inspect the code.

The navigation links work good, but according to bootstrap's doc:

As you scroll the “spied” container, an .active class is added and removed from anchor links within the associated navigation.

This is something i didnt observe. I inspected the code and active class is not appeared as i view different titles on the screen.

I believe I am using data attribute method to let is work, as the doc showed here

Something confused me a bit more is that if i copy the whole html from inspection and paste it to somewhere like codeply: https://www.codeply.com/p/1mUZYRPstZ its all working fine, the active class is added normally.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Finally figured it out:

  1. When adding or removing elements in the DOM, you’ll need to call the refresh method. This is from offical doc which I didnt follow
  2. In my local implementation, there is an async fetch call to retrieve blog content and the nav. The async call meets condition of #1, so I need to update scrollspy after element is rendered via useeffect or didMount
  3. This challenge also shows me I cannot always replace the plain html output of jsx with the jsx itself, even the two are identical. You never know if there are any side effect when generating the html via react.
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!