2012-06-29 79 views
0

即時通訊卡真的卡住了..一直坐着這段代碼現在..試圖用ColorBox做一個畫廊,看起來很不錯..我只有一個問題..我只是不能讓它成爲使用iframe後一組...ColorBox iframe rel(group)

http://www.lani.dk/thomas/temp/iframe_problem.zip

網站

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>-</title> 

<link media="screen" rel="stylesheet" href="css/colorbox.css" /> 
<script src="scripts/jquery.min.js"></script> 
<script src="scripts/jquery.colorbox.js"></script> 
<script> 
function showColorBox(imageURL) { 
$.fn.colorbox({ opacity: .6, open: true, href: imageURL }); 
} 
</script> 

</head> 
<body> 
<iframe src="iframe.asp" name="iframename" width="400" height="400" frameborder='0'  id="iframename"> 
<p>Your browser does not support iframes.</p> 
</iframe> 
</body> 
</html> 

IFRAME

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>-</title> 

<style type="text/css"> 
body { 
background-color: #999; 
} 
</style> 

<script src="scripts/jquery.min.js"></script> 
<script src="scripts/jquery.colorbox.js"></script> 
<script> 
$(document).ready(function() { 
$('a.colorbox').click(function (event) { 
    event.preventDefault(); 
    parent.showColorBox($(this).attr("href")); 
}); 
}); 
</script> 

</head> 
<body> 

<p><a href="images/gallery/pic1.jpg" class="colorbox" rel="group1">pic1</a></p> 
<p><a href="images/gallery/pic2.jpg" class="colorbox" rel="group1">pic2</a></p> 
<p><a href="images/gallery/pic3.jpg" class="colorbox" rel="group1">pic2</a></p> 

</body> 
</html> 
+0

你可以試試漂亮的照片插件。它類似於你所需要的 – muthu

+0

我可以問一下iframe的用途是什麼..?如果你沒有使用它,你可以做'$('a.gallery')。colorbox({rel:'group1'});' –

+0

它的一個網站,我已經有iframe,完整的背景圖像是慢動作幻燈片 - 所以我打開了所有的圖庫圖像 - http://www.lani.dk/thomas/temp/snapshot.jpg –

回答

0

請記住,ColorBox會掃描DOM以便資源在頁面加載時呈現。我懷疑插件沒有在iframe中看到資源,因此無法識別它們。

PS。喜歡糖果手杖的嘴脣。