Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 是否将回调添加到现有的colorbox调用?_Jquery_Callback_Colorbox - Fatal编程技术网

Jquery 是否将回调添加到现有的colorbox调用?

Jquery 是否将回调添加到现有的colorbox调用?,jquery,callback,colorbox,Jquery,Callback,Colorbox,我已有一个调用,在单击“iframe”类的链接时打开iframe颜色框: $(“.iframe”).colorbox({iframe:true,宽度:“200px”,高度:“500px”}) 我想在此colorbox中添加一个回调,以便在它即将打开时触发函数: onOpen:function(){alert('colorbox即将打开');} 但这段代码去了哪里?我尝试将其添加到colorbox()中,但整个操作都失败了。我有点困惑。下面是一个选项: $(".iframe").colorbox(

我已有一个调用,在单击“iframe”类的链接时打开iframe颜色框:

$(“.iframe”).colorbox({iframe:true,宽度:“200px”,高度:“500px”})

我想在此colorbox中添加一个回调,以便在它即将打开时触发函数:

onOpen:function(){alert('colorbox即将打开');}


但这段代码去了哪里?我尝试将其添加到colorbox()中,但整个操作都失败了。我有点困惑。

下面是一个选项:

$(".iframe").colorbox({iframe:true, width:"200px", height:"500px",onOpen:function(){ alert('colorbox is about to open'); }});

这是一个有效的例子

$(".iframe").colorbox({iframe:true, width:"200px", height:"500px",onOpen:openCallBack});

function openCallBack(){
//do something here
}