【发布时间】:2015-05-04 00:00:24
【问题描述】:
我继承了这个可行的模式/覆盖/内容关闭/空方法,但突然:
method.close = function () {
$modal.hide();
$overlay.hide();
$content.empty();
$(window).unbind('resize.modal');
};
为了逐渐淡出,我修改了如下方法,但是元素被留下,后续点击不会打开加载内容的新模态,只有叠加层:
method.close = function () {
$modal.fadeOut('slow', function() {
$(this).hide();
});
$overlay.fadeOut('slow', function() {
$(this).hide();
});
$content.fadeOut('slow', function() {
$(this).empty();
});
$(window).unbind('resize.modal');
};
我错过了什么?
更新:解决方案是单个嵌套回调,基于 garryp 的回答,如下所示:
method.close = function() {
$overlay.fadeOut('slow', function() {
$overlay.hide();
$content.empty();
});
$modal.hide();
$(window).unbind('resize.modal');
};
【问题讨论】:
标签: javascript jquery modalviewcontroller