dqask02082 2017-08-04 17:29
浏览 75
已采纳

iframe src全宽和高度

how can i make iframe src to full width and height ?

for example i have iframe like this

<iframe scrolling="no" frameborder="0" allowtransparency="true" style="border:none;width:100%;height:100&;" allowfullscreen="" src="http://www.example.com/page.php?width=100%&height=100%"></iframe>

this is just gonna have full size width and height of iframe only.

as you see this part page.php?width=100%&height=100%

if i keep it like that, it won't work. even if i make it like this page.php?width=auto&height=auto

what i need here to make this page.php?width=100%&height=100% to go full iframe width and height because the content of page.php will be resized if i change the size like this page.php?width=200&height=200

anyone help me with this please. appreciate it

  • 写回答

1条回答 默认 最新

  • dsa45664 2017-08-04 17:38
    关注

    Well passing the url query is a start but you need to use that information to give the page styling:

    src="page.php?fullscreen=true"

    This is just a rough example of what you might try, you may want to change the styles depending on whats necessary for you.

    <?php if (!empty($_GET['fullscreen'])) {?>
    <style>
    html, body {
      height:100%;
      width:100%;
    }
    </style>
    <?php } ?>
    

    You could do something similar passing in width and height independently and then using those values in the css:

    src="page.php?width=500&height=400"

    <?php if (!empty($_GET['width']) && !empty($_GET['height'])) {?>
    <style>
    html, body {
      height:<?php echo $_GET['height']; ?>px;
      width:<?php echo $_GET['width']; ?>px;
    }
    </style>
    <?php } ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改