Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

107
Visualizações
Resize the height of an element from the height of another dynamic element

I have 2 column of text dynamically rendered in nextJS. I want to set the max-height of the second column depending on the height of the first one.

I tried doing this, but it doesn't work. The problem seems to come form passing the variable as value, because if I replace descriptionHeight by 100px for exemple it works.

const descriptionHeight = document.getElementById('desc').offsetHeight;
    const generic = document.getElementById('generic');
    if (descriptionHeight <= generic.offsetHeight) {
      generic.style.maxHeight = descriptionHeight;
    }

I first tried to pass the offsetHeight value with inline style, inside the jsx, but I get an error for variable not defined

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda