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

232
Vistas
Flex container with flex-direction column-reverse will not scroll to top

I am displaying notifications in the following div in order to show the last elements at the top of the container :

<div class="flex h-full max-h-full pt-36">
    <div id="scrollDiv" class="justify-bottom z-20 flex w-full flex-col-reverse items-center overflow-y-scroll scrollbar-thin">
        <div class="notification"></div>
        <div class="notification"></div>
        <div class="notification"></div>
        <div class="notification"></div>
    </div>
</div>

Automatically, when the container overflows, it is scrolled to the bottom. I have tried to set scrollTop using the following Javascript with no success :

function scrollNotifications() {
    var element = document.getElementById('scrollDiv')
    element.scrollTop = element.scrollHeight
}

How can I scroll the container to the top when overflowing on the y axis ?

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

0

The problem was with the scrollTop positioning. The 0 value will scroll to the bottom because of the reverse direction property. The simple trick was to set a negative value :

function scrollNotifications() {
    var element = document.getElementById('scrollDiv')
    element.scrollTop = -element.scrollHeight
}
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