在這裏有幾個類似這個問題的問題,但他們的解決方案似乎不適合我。基本上我已經在網頁上嵌入了一個頁面,並且正在獲取雙滾動條,其中一個位於iframe中,另一個位於嵌入的頁面中。我想要的是取消iframe中的滾動條並使其它擴展了iframe的100%,並只使用我的頁面中的滾動條。所以很難說它是一個嵌入式頁面。我使用Bootstrap的iframe嵌入類來保持頁面響應。如果我需要取消那個班,那很好。這裏是html。如何在嵌入頁面時刪除雙滾動條?
<div class="container">
<div class="main">
<div class="inner-main">
<h1>Page Heading</h1>
<div class="row">
<div class="col-lg-12">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="mylink"></iframe>
</div>
</div>
</div>
</div>
</div>
</div>
有沒有簡單的方法來做到這一點?嵌入式頁面相當長,所以我需要它一直推動我的頁面。
這裏是我落得這樣做:
<iframe onload="scroll(0,0);" class="embed-responsive-item" src="mylink"></iframe>
CSS
.embed-responsive-16by9 {
height: 6060px;
}
iframe {
width: 100%;
display: block;
height: 6060px;
}
我會在尋找更好的方式來做到這一點
您需要獲取內頁的高度並將高度指定給iframe。這可以通過使用jQuery來完成。該腳本將在iframe頁面上運行,並將調用父頁面或window.parent中的腳本。$(elementid).attr(attributeName); –
我最終基本上只是用CSS來做這件事。將iframe高度設置爲原始頁面的高度。 – jfoutch
你可以請分享代碼 –