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

129
Vistas
Hide iframe if height is 150px

I have an iframe which is loading external content dynamically from a site I have control of.

In case no content is available I load an empty page.

Unfortunately an iframe has a height of 150px.

How can I at best with Javascript define to hide the mother div (container) or iframe in case the iframe has the standard size of 150px?

<div id="container">

<iframe src=""> </iframe>

</div>
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can use the client.Height to get the Height of an element (with padding, the border is not included)

Try this:

const iframe = document.querySelector('iframe');
let iframeHeight = iframe.clientHeight;

if (iframeHeight == 150) {
    iframe.style.display = "none";
}

It will be hide the first iframe with standard height. Let me know for more requirements. Hope it helps!

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can use

window.getComputedStyle(element);

And it will give you an object with all css properties of that element.

If you want to get the height:

window.getComputedStyle(element).height;

And that will return ’150px’, or whatever else the height will be

Note: typing ‘window’ is not required, getComputedStyle() will also work

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