2011-03-29 106 views
3

如何使用colorbox顯示iframe。我試着跟着。如何使用colorbox顯示iframe

$.colorbox({inline:true, href:"#html_content", onLoad:function(){ 
alert("Colorbox Loaded") 
}}); 

<body class="html_body" id="html_content_body"> 
<div id="html_content"> 
<form id="ajaxadd" action="/patient_add/" method="post" name="FormName" class="prettyform"> 
{% csrf_token %} 

<table id="table_one" width="448" border="0" cellspacing="2" cellpadding="0"> 
.... 
</table> 
</div> 
</body> 
</html> 
+0

你嘗試onLoad事件? – Coolbreeze 2011-03-29 08:23:14

+0

你目前有任何代碼? – Ant 2011-03-29 08:28:56

+0

請更具體的在您的問題,並提供代碼,如果可能的 – corroded 2011-03-29 08:36:55

回答

8

通過查看您的代碼,我認爲您沒有把腳本放在正確的位置。我一定是這樣的。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> 
<script src="colorbox/jquery.colorbox.js"></script> 
<link rel="stylesheet" href="colorbox.css"/> 
<script> 
    $(function() 
    { 
     $(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});  
    }) 
</script> 
<a class='example6' href="http://google.com">Outside Webpage (Iframe)</a> 

在Firefox

On Firefox

在Chrome enter image description here

+0

我認爲這種方法運行良好,但我的信號東西顯示在後臺以及燈箱的原因(多個ID)我的jquery datetimepicker停止工作,因爲他們正在運行的背景..根據我的上述代碼.. – GoldenBird 2011-03-29 09:00:28

+0

@GoldenBird你使用的是彩盒或燈箱?你可以給我鏈接,並嘗試格式化你的代碼。 – 2011-03-29 09:04:59

+0

@experimentX http://colorpowered.com/colorbox/這是鏈接 – GoldenBird 2011-03-29 09:15:30