2015-10-06 91 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

相关问题