簡體   English   中英

動態增加iframe高度

[英]Increase iframe height dynamically

我正在嘗試將游戲集成到我的phpfox社交網絡中。 產生的代碼是由第三方提供的,就像這樣

<script type="text/javascript">
            $(document).ready(function(){               
                $('body').append('<iframe id="crossdomain_frame" src="<?php echo APP_URL; ?>static/crossdomain.php?height=' + document.body.scrollHeight + '&nocache=' + Math.random() + '" height="0" width="0" frameborder="0"></iframe>');
            });     
        </script>

在設置東西時,框架的高度混亂了。 我不明白如何增加高度。 在加載頁面源代碼時,我發現<iframe>甚至在頁面中都沒有heightwidth屬性。 有人可以幫忙嗎?

附注:您可以通過打開http://social.techbreeze.in/index.php?do=/apps/4/candy-rush/並使用您的Facebook帳戶登錄來查看頁面的外觀。

將iframe附加到正文后,可以使用jquery設置iframe的高度。

$(document).ready(function(){               
       $('body').append('<iframe id="crossdomain_frame" src="<?php echo APP_URL; ?>static/crossdomain.php?height=' + document.body.scrollHeight + '&nocache=' + Math.random() + '" height="0" width="0" frameborder="0"></iframe>');
       $('#crossdomain_frame').css('height', $(window).height()+'px');
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM