簡體   English   中英

iframe可以自動調整高度,從其他網站加載頁面

[英]iframe to load page from another site with auto adjustable height

我有兩個博客。 我需要鏈接那些。

'one.html' 'website1.com' 'one.html'應加載'website2.com'.

地址'website2.com'不應顯示,而應顯示'website1.com/one.html'

它必須在不剪切內容的情況下進行滾動(自動調整高度,基於內容/帖子數),但是滾動條不可見。

我創建了一個iframe ,也能夠隱藏滾動條,但是它沒有自動調整高度。 它要么不顯示全部內容,要么顯示一半內容。

請提供適當的HTMLCSS和/或Javascript代碼以執行相同的操作。

提前致謝。

<style>
 #support-box {
        width: 50%;
        float: left;
        display: block;
        height: 20rem; /* is support box height you can change as per your requirement*/
        background-color:#000;
    }
    #wrapper {
        width: 90%;
        display: block;
        position: relative;
        top: 50%;
        transform: translateY(-50%);
         background:#ddd;
       margin:auto;
       height:100%; /* here the height values are automatic you can leave this if you can*/

    }
    #wrapper iframe {
        width: 100%;
        display: block;
        padding:10px;
        margin:auto;
    }
</style> 
<div id="content" >
    <div id="support-box">
        <div id="wrapper">
            <iframe name="frame" id="frame" src="website2.com" frameborder="0"></iframe>
        </div>
    </div>
  </div>

演示: https : //jsfiddle.net/umd2ahce/6/

暫無
暫無

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

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