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

250
Vistas
is there a way to iterate through array, listing each item in fixed-height container until all available space taken?

Using Vue, I have a div container with fixed height, overflow: hidden, I want to iterate through javascript array, adding each item to the div, and stop when the bottom of the div space is reached. Would also need it to be responsive.

<div class="container">
  <div class="header">Header</div>
  <div class="body" v-for="item in items">
    <div>{{ item.data }}</div>
  </div>
  <div class="footer">Footer</div>
</div>

.container {
  display: flex;
  height: 100%;
  flex-direction: column;
}

.header {
  height: 100px;
}

.footer {
  height: 100px;
}

.body {
  flex: 1;
  overflow: hidden;
}

Maybe you would need to retrieve the height of the container in pixels and divide by font height of your item.data perhaps? In any case the number of items displayed would need to change whenever window is resized in order to make it responsive.

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

0

  1. You could do it like you are doing it, and use element.offsetHeight to know when you've gone too far
  2. You could set CSS property max-height to set a max height (you might also want to set the overflow-y property)
  3. You could use a SELECT and set the size attribute on that
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