2011-03-29 111 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