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

130
Views
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 answers
Answer question

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 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!