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

310
Views
Adjusting the layout of the contents of an iframe depending on the window size

I have an iframe that links to a Fortran code documentation created using FORD. It has the same layout as this page. I want to use an iframe on my sphinx website to display its contents on one of its pages. However, linking to it causes the layout of the iframe contents not to change as it would if only the documentation was opened. Instead, it pushes the full-sized window to the left so that only half of it is visible, like in the following picture:

current full website layout

Is there a way to scale the iframe contents down as the window layout changes so that the borders are first minimized, and then a scrollbar is displayed at the bottom? The iframe is embedded into the site as follows:

.. raw:: html

      <iframe src="path_to_FORD_documentation_index.html" style="position:fixed; top:auto; left:auto; bottom:auto; right:auto; width:100%; height:100%; border:none; margin:auto; padding:auto; overflow:hidden; z-index:999999;">
      Your browser doesn't support iframes
      </iframe>

I have already tried the javascript-based approach from this question, but this only created a scrolling bar at the bottom of the main page but didn't resize the iframe's contents.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Without having much to go on, I think your problem is in your height and width properties. Your DOM is loading the iFrame before the iFrame is loading the content. So when the element is created, it's got no width or height to it, so the iFrame defaults to min height/width. Solution could be to preload the iFrame link:

<link rel="preload" href="https://path_to_FORD_documentation_index.html" as="document"> then call iFrame as you do now

OR you could resize the iFrame in a function and call it after the page loads:

<script>
iFrame.width  = iFrame.contentWindow.document.body.scrollWidth
iFrame.height = iFrame.contentWindow.document.body.scrollHeight
</script>
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!