I want to prevent closing the colorbox accidentally so I'll be showing/hiding the close button from inside the loaded iframe.
I read the documentation but both examples don't seem to work:
var originalClose = $.colorbox.close;
$.colorbox.close = function(){
var response;
if($('#cboxLoadedContent').find('form').length > 0){
response = confirm('Do you want to close this window?');
if(!response){
return; // Do nothing.
}
}
originalClose();
};
or
<!-- calling colorbox's close method from within an iframe: -->
<a href='#' onclick='parent.$.colorbox.close(); return false;'>close this iframe</a>
... the colorbox just doesn't close. What am I doing wrong?
in the console I see:
Uncaught TypeError: Cannot read property 'colorbox' of undefined
Thanks!