jquery - Fancybox onClosed 函数在盒子打开之前发生?

标签 jquery fancybox

在我的 Fancybox 完全关闭且页面恢复正常后,我尝试触发第二个 jquery 函数。我尝试使用 onClosed fancybox 属性,但它不是在框关闭后发生,而是在框打开之前发生(在页面加载时,因为我将 fancybox 设置为在页面加载时打开)。我错过了什么?

$(document).ready(function () {
    $("a#splash").trigger('click');
    $("a#splash").fancybox({
        'autoScale': false,
        'transitionIn': 'none',
        'transitionOut': 'none',
        'type': 'inline',
        'hideOnContentClick': true,
        'overlayOpacity': 1,
        'onClosed': alert('testing')
 });
});

最佳答案

尝试

$(function(){
    $("a#splash").trigger("click");
    $("a#splash").fancybox({
        "autoScale": false,
        "transitionIn": "none",
        "transitionOut": "none",
        "type": "inline",
        "hideOnContentClick": true,
        "overlayOpacity": 1,
        "onClosed": function(){
            alert("Testing! FancyBox closed.");
        }
    });
});

关于jquery - Fancybox onClosed 函数在盒子打开之前发生?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5332516/

相关文章:

javascript - 在另一个数据表的子行中添加嵌套数据表

javascript - 如何捕获用户点击后退按钮?

jquery - Fancybox 在 IE 中加载 iframe 时卡住

javascript - 计算 <p> 中没有 id 或类的 <img>

javascript - 多个 div 的 jQuery .click() 事件

javascript - 如何确保每次 css 类名从以前更改时,它都应用特定的样式

javascript - fancybox 实现

javascript - 用精美的框警报替换 JavaScript 警报弹出窗口

javascript - 使用 jquery 检查 fancybox 是否存在 rel=group?

javascript - Fancybox box 在我将它上传到 webhost 但在 localhost 上工作后不工作