Search code examples
jquerycolorbox

How can I make colorbox to open in full when clicking on an image?


Right now the default behavior of colorbox is to move to the next image, when an image is clicked. How can I make colorbox open a new page with that image in full instead?

Thanks!


Solution

  • I'm not sure if that's the greatest functionality, but you can hook into the cbox_complete event to define a handler which will unbind the current click handler and wrap the image in a link to itself: jsFiddle

    $(document).bind('cbox_complete', function(){
        var $photo = $('.cboxPhoto').unbind("click");
        var src = $photo.attr('src');
        $photo.wrap('<a href="' + src + '" />');
    });