Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

64
Views
js obtiene la altura más alta del elemento y establece todos los demás elementos a esta altura

Tengo un "elemento P". Entonces la altura de cada elemento puede ser mayor que la del otro. Entonces quiero que todas las alturas sean de la misma altura, pero todas las más altas.

No me da error pero no funciona.

 const getHeightAndSetNewHeight = () => { const k = document.querySelectorAll('.kamera'); k.forEach(e => { if(Math.max(Number(e.offsetHeight))) { e.style.height = `${e.offsetHeight}px`; } }); };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Debe recorrer una vez, encontrar el máximo y luego volver a recorrer una vez que lo tenga.

 const getHeightAndSetNewHeight = () => { const k = document.querySelectorAll('.kamera'); let max = -Infinity; k.forEach(e => { if (max < e.offsetHeight) max = offsetHeight; }); k.forEach(e => { e.style.height = `${e.offsetHeight}px`; }); };
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!