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 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大