How to simulate a close() in facebox
I am using facebox popup in one of my pages. I am having a button in the popup dialog. When I click that button the facebox popup should close (the same way it closes when we press outside the popup). How to do that?
Also, I am do开发者_运维问答ing some Ajax stuff when that button is being pressed so I cannot override the onClick event.
$(function() {
$('#button-id').click($.facebox.close);
});
as long as you aren't actually setting event handlers through onclick, adding handlers won't override existing ones.
<a href='javascript:void(0);' onclick='jQuery("#facebox_overlay").click();'>close</a>
here's an onclick version hack
For close the facbox in code, trigger:
jQuery(document).trigger('close.facebox');
I had a problem closing facebox, and was thay the dark overlay that appeared when opened it, didn´t close.
the solution I used was this one:
$(document).bind('close.facebox', function() {
$('#back').hide();
})
back is the id of the dark overlay
Hope this is usefull
Greetings from Spain
精彩评论