Jquery 是否将回调添加到现有的colorbox调用?
我已有一个调用,在单击“iframe”类的链接时打开iframe颜色框: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”).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
}