Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

115
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda