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 } ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于博途V17进行仿真时无法建立连接问题
  • ¥15 请问下这个红框里面是什么文档或者记事本编辑器
  • ¥15 机器学习教材中的例题询问
  • ¥15 求.net core 几款免费的pdf编辑器
  • ¥15 为什么安装HCL 和virtualbox之后没有找到VirtualBoxHost-OnlyNetWork?
  • ¥15 C# P/Invoke的效率问题
  • ¥20 thinkphp适配人大金仓问题
  • ¥20 Oracle替换.dbf文件后无法连接,如何解决?(相关搜索:数据库|死循环)
  • ¥15 数据库数据成问号了,前台查询正常,数据库查询是?号
  • ¥15 算法使用了tf-idf,用手肘图确定k值确定不了,第四轮廓系数又太小才有0.006088746097507285,如何解决?(相关搜索:数据处理)