Search code examples
javascriptcolorbox

Is it possible to disable click listener on colorbox image?


How can I disable the default behavior of going to the next image when clicking on the current image using colorbox?

fiddle showing the issuehttp://jsfiddle.net/LgwkLck0/

$.each($('.colorbox'), function(i, val) {
    $(val).colorbox({
        rel: "images",
        photo: true,
        onComplete: function() {
            //TODO: remove click listener
            // $('.cboxPhoto').unbind('click');
            // $('.cboxPhoto')[0].removeEventListener('click');
            // Does not work
        }
    });
});

Solution

  • Got my answer here: https://github.com/jackmoore/colorbox/issues/668

    $('a.example').colorbox({onComplete: function(){
        $('.cboxPhoto')[0].onclick = null;
    }});