1

我使用彩盒 iframe:

$(document).ready(function(){
    $(".iframe").colorbox({iframe:true, width:"85%", height:"65%", fastIframe:false});      
});

在我的第二页上,我有一个按钮,我想在其中发布一些图像,并且在操作之后我想关闭框架窗口。

<input type="button" id="selected" value="the_button" />

和脚本

$( document ).ready(function() {

    $("#selected").bind('click',function() {

        window.setTimeout(function() 
        {
            $.colorbox.close(); 
        }, 2500);

        alert('hi');

    });

});
4

3 回答 3

0

试试这样:

$( document ).ready(function() {

    $("#selected").bind('click',function() {

        window.setTimeout(function() 
        {
           parent.$.colorbox.close();
        }, 2500);


    });

});
于 2013-03-14T14:51:16.930 回答
0

我面临同样的问题,我用$('#cboxClose').remove(); 它为我工作。

于 2013-09-12T07:21:56.423 回答
-1

将此添加到您的 HTML:

<a href="#" onClick="$.colorbox.close();">Close Colorbox</a>
于 2016-05-26T09:43:28.173 回答