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

126
Vistas
How to Hide Iframe if web browser size is reduced or in windowed mode

I'm trying to make an Iframe hidden if the screen size is smaller than the width of the IFrame. Right now if I'm using a small laptop the side of the website has a white line (see pic below) and I would just like to hide the Iframe if the screen size or web browser is too small.

Here is my code, it seems to work with mobile devices, but when I resize my web browser it doesn't hide.

       <iframe embed class="v-tour-object" style=position:absolute;left:700px;top:0px; width="550" height="360"
src="https://www.youtube.com/embed/tgbNymZ7vqY">
</iframe>

<script>
 if(window.innerWidth <= 1000 && window.innerHeight <= 800) {
   document.querySelector('.v-tour-object').style.display = "none"
}
</script> 

enter image description here

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

0

You should handle window resize event

OR

Css Media Query

window.addEventListener("resize", () => {
    const h = window.innerHeight;

    if (h < 920) document.querySelector(".v-tour-object").style.display = "none";
});

Css

@media only screen and (max-height: 920px) {
    .v-tour-object {
        didplay: none;
    }
}
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