2015-10-06 89 views
0

我似乎無法弄清楚如何導航用戶到另一個頁面,當點擊圖像使用Colorbox。任何幫助表示讚賞,謝謝!導航到另一個頁面,點擊圖像使用Colorbox

這裏是我的代碼 - >

<html> 
<head> 
    <title>Pop up!</title> 
    <link href="colorbox.css" rel="stylesheet"></link> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script> 
<script src="jquery.colorbox-min.js" type="text/javascript"></script> 
<script type="text/javascript"> 
$(document).ready(function(){ 
    $.fn.colorbox({href:"Pop_up_Int.jpg", open:true}); 
}); 
</script> 
</head> 
<body> 

</body> 
</html> 
+0

你不能只是將圖像包裝在錨元素中嗎? – charlietfl

+0

你能提供一個小提琴嗎? –

+0

不,你可以看到,一切都在頭標籤內,並由colorbox處理..或者我錯過了一些東西。有任何想法嗎? :) – codemode

回答

0

我不知道,如果你正在使用會做的伎倆顏色框的版本。最新的版本有所回調(的onComplete),你可以利用它作爲這樣的:

$(document).ready(function(){ 
    var url = "http://www.passmark.com/images/monitortestscreenshot5.gif"; 
    $.colorbox({href:url, onComplete: function() { 
     $('#colorbox img.cboxPhoto').wrap('<a href="'+url+'"></a>'); 
    }}); 
}); 

小提琴:http://jsfiddle.net/bes2j53n/1/

+0

這就是它!我正在使用一個漂亮的舊版本。謝謝! – codemode

相關問題