실수로 colorbox를 닫지 않도록하여로드 된 iframe 내부에서 닫기 버튼을 표시하거나 숨길 수 있습니다.ColorBox - 닫는 것을 방지합니다.
나는 문서를 읽을 수 있지만 두 예제는 작동하지 않습니다
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();
};
또는
<!-- calling colorbox's close method from within an iframe: -->
<a href='#' onclick='parent.$.colorbox.close(); return false;'>close this iframe</a>
...을 colorbox 단지 닫히지 않습니다. 내가 도대체 뭘 잘못하고있는 겁니까? 콘솔에서
나는 참조 :
Uncaught TypeError: Cannot read property 'colorbox' of undefined
감사합니다!
사실, 정상적으로 작동하지만 iframe 내에서 작동하지 않습니다. – 3zzy
같은 도메인의 @Nimbuz iframe? – webdeveloper
아니요, 외부 도메인입니다. 다른 도메인의 콘텐츠가 iframe에로드된다는 의미입니다. – 3zzy