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

306
Vistas
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 Respuestas
Responde la pregunta

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