Colorbox not recognizing "onClosed"
I have a colorbox that appears upon clicking a link. Within the colorbox is a cancel button that calls $.colorbox.close(). However, the onClosed callback never fires.
$('input#close-comment-form').on('click', function(e) {
$.colorbox.close({
onClosed: function() {
console.log('hi2');
}
});
});
I'm not sure what the problem is. The colorbox does fade away, but the console.log never fires.
I'm guessing it has something to do with this:
This method initiates the close sequence, which does not immediately complete. The lightbox will be completely closed only when the cbox_closed event / onClosed callback is fired.
The close method takes no arguments, so the options object you've passed it here is going to be ignored. The colorbox method ($.colorbox(obj) or $(selector).colorbox(obj)) is what takes the option object, so you would use it when assigning Colorbox to an element, or when opening Colorbox directly.
You didn't really answer my question, but I figured it out on my own anyway.