TIMEX
TIMEX

Reputation: 271734

Using Colorbox (JQuery lightbox plugin), how do I click the image to close the lightbox?

$('a.post_ext_img').colorbox({
            photo: true,
            transition: 'none'
        });

I am using this plugin: http://jacklmoore.com/colorbox/

Is there a way to make it so that when user clicks the photo, it closes it?

Upvotes: 1

Views: 1971

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038780

I don't think that the plugin provides an option for this. So you could subscribe to the click event of the image and trigger the close method manually:

$('a.post_ext_img').colorbox({
    transition: 'none', 
    photo: true,
    onComplete: function(result) {
        $('.cboxPhoto').click(function() {
            $(this).unbind('click');
            $.colorbox.close();    
        });
    }
});

And here's a live demo.

Upvotes: 2

Related Questions