Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

308
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda