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

150
Vistas
How to stop react component from going past the top of the page when scrolling

I want to make it do that when a user scrolls down a page, one of my react components reaches the top of the page, and stays there, not going any further up.

Imgur link to 'intranet' app im building: https://imgur.com/a/nWdDOrC

In the image, the component with the thick red border should stay at the top of the page when scrolling, with a margin. Tried fixing position, but I don't want it static, just not scrollable past the top of the page.

There are other similar questions, but none that seem to tackle this particular problem exactly - please correct me if I'm wrong.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You should look at the sticky position in css.

A sticky element toggles between relative and fixed, depending on the scroll position. It is positioned relative until a given offset position is met in the viewport - then it "sticks" in place (like position:fixed).

.component {
  position: sticky;
  top: 0;
}

ref: https://www.w3schools.com/howto/howto_css_sticky_element.asp

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