我的弹出窗口中有一些表单控件,如果表单无效,我想阻止用户关闭它。
我只是作为测试尝试过,但是当用户单击关闭按钮等时,弹出窗口仍然关闭。
$.magnificPopup.open({
items: {
src: '#topic'
},
type: 'inline',
removalDelay: 500, //delay removal by X to allow out-animation
mainClass: 'mfp-3d-unfold',
closeMarkup: '<button title="Close (Esc)" type="button" class="mfp-close"></button>',
midClick: true, // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
callbacks: {
beforeClose: function () {
// Callback available since v0.9.0
return false;
},
close: function () {
// Will fire when popup is closed
return false;
}
}
});