2014-06-17 21 views
0

我想創建一個尺寸爲200X200的iframe。我想在其中使用彈出式代碼。但我面臨一個問題,如何在iframe中使用彈出窗口來覆蓋包含iframe的整個頁面?

當前彈出顯示當我點擊空間200x200,但我希望彈出窗口顯示,當我點擊具有iframe的頁面。 (不僅是iframe區域,但整個頁面)

每當我把頁面放在一個頁面上我想彈出窗口是apear,因爲它是原始頁面的彈出窗口而不是iframe。

任何人有任何想法如何我可以執行此操作與HTML,JavaScript或jQuery的?

感謝

回答

0

使用自動調整大小的JavaScript代碼

<script type="Text/JavaScript" language="JavaScript"> 
<!-- 
function resize_iframe() 
{ 
    var height=window.innerWidth;//Firefox 
    if (document.body.clientHeight) 
    { 
     height=document.body.clientHeight;//IE 
    } 
    //resize the iframe according to the size of the 
    //window (all these should be on the same line) 
    document.getElementById("cam").style.height=parseInt(height- 
    document.getElementById("cam").offsetTop-8)+"px"; 
} 

// this will resize the iframe every 
// time you change the size of the window. 
window.onresize=resize_iframe; 

//Instead of using this you can use: 
// <BODY onresize="resize_iframe()"> 

</script> 
</head> 
<body> 
<iframe id="cam" width="100%" scrolling="yes" src="http://www.your_page.com" onload="resize_iframe()"> 
</iframe> 
</body> 

這將幫助你

0

使彈出呼叫時,用戶點擊在身上,不僅框架的元素。 如果您提供您的JavaScript & HTML代碼,我可以幫助您更多。

相關問題