2013-08-27 199 views
0

此iframe的寬度和高度不會改變。我需要響應式設計。請幫忙。Iframe寬度和高度不會改變

現在:

<iframe src="http://www.kadinvekadin.net/mod-burclar.php" 
     frameborder="0" 
     scrolling="no" 
     width="300" 
     height="300"> 

修改500×500 - 不工作,還是300×300:

<iframe src="http://www.kadinvekadin.net/mod-burclar.php" 
     frameborder="0" 
     scrolling="no" 
     width="500" 
     height="500"> 
+0

你需要讓你的iframe響應所有頁面或你只需要在500 * 500,顯示他們呢? –

+0

我想要響應式設計。但是這個iframe(http://www.kadinvekadin.net/mod-burclar.php)不能調整大小。尺寸不要改變。如何改變寬度/高度? – mogutcan

+0

此iframe設置最大調整大小300x300。例如,我想要350x350,但我不這樣做。 @PrasannaAarthi – mogutcan

回答

0

您需要環繞容器的iframe和應用樣式給它一個純CSS的解決方案,用於更多詳情請參閱http://andmag.se/2011/11/responsive-embeds/

另一種選擇是使用jquery 請在織機上https://gist.github.com/aarongustafson/1313517

試試這個代碼,

<html> 
<body> 
<style> 
html,body  {height:100%;} 
.wrapper   {width:80%;height:100%;margin:0 auto;background:#CCC} 
.iframe1  {position:relative;} 
.iframe1 .ratio {display:block;width:100%;height:auto;} 
.iframe1 iframe {position:absolute;top:0;left:0;width:100%; height:100%;} 

</style> 
<div class="wrapper"> 
<div class="iframe1"> 

    <img class="ratio" src="sometransparentimage.jpg"/> 
    <iframe src="http://www.kadinvekadin.net/mod-burclar.php" frameborder="0" 

     allowfullscreen></iframe> 
    </div> 

    </div> 
    </body> 
    </html> 
+0

我也試過兩個選項。但仍然這個iframe:http://www.kadinvekadin.net/mod-burclar.php不可調整大小。請幫忙。 – mogutcan

+0

試試這個代碼,看看你的預期輸出是什麼.. –

+0

謝謝你我試過這段代碼和jQuery。 「sometransparentimage」是響應式的,但iframe不響應。當我調整瀏覽器窗口的大小時,這個iframe仍然不響應。有沒有其他方法可以響應這個iframe? – mogutcan