I would like to trigger a simple jQuery function based on a fancybox closing. it is the only fancybox on the page
我想基于fancybox关闭来触发一个简单的jQuery函数。这是这一页上唯一的繁文缛节
$.fn.fancybox.close = function() {
$('#sub_cont').hide(250, function() {
$('#IDsearchform input').val('');
});
});
ofcourse the above doesn't work
当然,上面的方法行不通
4 个解决方案
#1
44
*Update: * Please take a note of @mathoiland's answer, "It looks like Fancybox 2 deprecated the onClosed callback. It now uses afterClose." if you are using FancyBox 2.x
*更新:*请注意@mathoiland的回答,“看起来Fancybox 2不赞成onClosed回调。”如果你用的是FancyBox 2.x
Pass the onClosed option to the fancybox function.
将onClosed选项传递给fancybox函数。
i.e:
即:
$("<YOUR-SELECTOR>").fancybox({
onClosed: function() {
$('#sub_cont').hide(250, function() {
$('#IDsearchform input').val('');
});
})
});
#2
32
Just a note. It looks like Fancybox 2 depreciated the onClosed callback. It now uses afterClose.
只是一个注意。看起来Fancybox 2贬低了onClosed回调。现在使用afterClose。
See the new documentation under 'Callbacks'. http://fancyapps.com/fancybox/
请参阅“回调”下的新文档。http://fancyapps.com/fancybox/
#3
15
In latest version of fancybox you might need to use 'afterClose' in place of 'onClosed'
在fancybox的最新版本中,您可能需要使用“afterClose”来代替“onClosed”
so this code..
所以这段代码. .
$("<YOUR-SELECTOR>").fancybox({
onClosed: function() {
$('#sub_cont').hide(250, function() {
$('#IDsearchform input').val('');
});
})
});
should become ...
应该成为…
$("<YOUR-SELECTOR>").fancybox({
afterClose: function() {
$('#sub_cont').hide(250, function() {
$('#IDsearchform input').val('');
});
})
});
#4
7
$("#myfancybox").fancybox({
'onClosed' : function() {
$('#sub_cont').hide(250, function() {
$('#IDsearchform input').val('');
});
}
});
#1
44
*Update: * Please take a note of @mathoiland's answer, "It looks like Fancybox 2 deprecated the onClosed callback. It now uses afterClose." if you are using FancyBox 2.x
*更新:*请注意@mathoiland的回答,“看起来Fancybox 2不赞成onClosed回调。”如果你用的是FancyBox 2.x
Pass the onClosed option to the fancybox function.
将onClosed选项传递给fancybox函数。
i.e:
即:
$("<YOUR-SELECTOR>").fancybox({
onClosed: function() {
$('#sub_cont').hide(250, function() {
$('#IDsearchform input').val('');
});
})
});
#2
32
Just a note. It looks like Fancybox 2 depreciated the onClosed callback. It now uses afterClose.
只是一个注意。看起来Fancybox 2贬低了onClosed回调。现在使用afterClose。
See the new documentation under 'Callbacks'. http://fancyapps.com/fancybox/
请参阅“回调”下的新文档。http://fancyapps.com/fancybox/
#3
15
In latest version of fancybox you might need to use 'afterClose' in place of 'onClosed'
在fancybox的最新版本中,您可能需要使用“afterClose”来代替“onClosed”
so this code..
所以这段代码. .
$("<YOUR-SELECTOR>").fancybox({
onClosed: function() {
$('#sub_cont').hide(250, function() {
$('#IDsearchform input').val('');
});
})
});
should become ...
应该成为…
$("<YOUR-SELECTOR>").fancybox({
afterClose: function() {
$('#sub_cont').hide(250, function() {
$('#IDsearchform input').val('');
});
})
});
#4
7
$("#myfancybox").fancybox({
'onClosed' : function() {
$('#sub_cont').hide(250, function() {
$('#IDsearchform input').val('');
});
}
});