jQuery Fantasybox onClosed 回调不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9250540/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 10:33:05  来源:igfitidea点击:

fancybox onClosed callback does not work

jqueryjquery-uifancybox

提问by Andreas

I am using fancyBox v2.0.4 ...

我使用的是fancyBox v2.0.4 ...

Well this should be simple, however it does not work in my case... I simply want to run a callback function when the fancybox is closed...

好吧,这应该很简单,但是在我的情况下它不起作用......我只想在fancybox关闭时运行回调函数......

$('a#stpa_announcement_details_open').fancybox({
    'onCleanup': function() { alert('test') },
    'hideOnContentClick': true
});

does not work

不起作用

$('a#stpa_announcement_details_open').fancybox({
    'onClosed': function() { alert('test') },
    'hideOnContentClick': true
});

does not work

不起作用

回答by Janis

You are using options from older versions, so it would be like -

您正在使用旧版本的选项,所以它就像 -

$('a#stpa_announcement_details_open').fancybox({
    'beforeClose': function() { alert('test') },
    'closeClick': true
});

You can find these options at http://fancyapps.com/fancybox/#docs

您可以在http://fancyapps.com/fancybox/#docs 上找到这些选项

回答by Prabhagaran

 $('a#stpa_announcement_details_open').fancybox({
   'afterClose': function() {
                               alert('test') 
                             }
  });

Hope it works..

希望它有效..

回答by Ali

use beforeClose or afterClose. Find the API documentation under the Callbacks tab here http://fancyapps.com/fancybox/#docs

使用 beforeClose 或 afterClose。在此处的回调选项卡下找到 API 文档http://fancyapps.com/fancybox/#docs