【问题标题】:Add a callback to an existing colorbox call?向现有的彩盒调用添加回调?
【发布时间】:2012-10-05 02:06:10
【问题描述】:

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

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

我想给这个颜色框添加一个回调,以便在它即将打开时触发一个函数:

onOpen:function(){ alert('colorbox is about to open'); }

但是这段代码去哪里了?我尝试将它添加到 colorbox() 但整个事情都失败了。我有点困惑。

【问题讨论】:

    标签: jquery callback colorbox


    【解决方案1】:

    它作为一个选项如下:

    $(".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
    }
    

    here 是一个工作示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多