使用 Colorbox 单击图像导航到另一个页面

Navigate to another page, on clicking image using 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>

我不确定您使用的 colorbox 版本是否可以解决问题。最新版本有一个回调 (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>');
    }});
});

Fiddle: http://jsfiddle.net/bes2j53n/1/.