如何从框架内关闭$ .colorbox

时间:2012-01-04 02:53:11

标签: jquery jquery-plugins colorbox

我正在使用colorbox / jquery.colorbox.js。 我有以下代码(如下),它工作正常。 我试图弄清楚如何从iframe内部关闭它。 从常见问题解答中,我试过了 onClick='parent.$.colorbox.close(); return false;' 但得到了错误Permission denied to access property '$'

感谢您的帮助。

$(".iframepop").colorbox({
    width:"630px", height:"650px", iframe:true, overlayClose: false, fastIframe: false,
    onOpen:function(){ 
        iframeID = $(this).attr("id");
    },
    onLoad:function(){
        $('#secureContent').animate({width: "600px"}, 'fast');
    },
    onCleanup:function(){ 
    },
    onClosed:function(){ 
        switch($(this).attr("id")){
            case 'goto_home':
                window.location = "/secure/iframeredirect.php";
                break;
            case 'goto_myaccount':
                document.body.style.cursor = 'wait';
                window.location = "/myaccount";
                break;

        }
    }
});

2 个答案:

答案 0 :(得分:0)

你可以使用$(' #cboxClose')。remove();从iframe内部关闭彩盒。

答案 1 :(得分:0)

.remove()只需移除关闭按钮,即可使用$('#cboxClose').click();