var magnificPopup = $.magnificPopup.instance;
// save instance in magnificPopup variable
magnificPopup.close();
// Close popup that is currently opened
var magnificPopup = $.magnificPopup.instance; // save instance in magnificPopup variable
magnificPopup.close(); // Close popup that is currently opened
var mgObj=$('your-selecter').magnificPopup({
// you options
});
// code to close pop up on clicking a button
$(document).on('click','button',function(){
if(mgObj)
{
mgObj.close();
}
});
7条答案
按热度按时间xcitsw881#
使用
$.magnificPopup.close()
即可t1rydlwq2#
试试这个:
yacmzcpb3#
点击这里http://dimsemenov.com/plugins/magnific-popup/documentation.html#api
以下是您可以关闭此弹出窗口的一些方法:
或
$.magnificPopup.close();
或
$('your-selector').magnificPopup('close');
对我来说,只有第三个工作效率高。
ajsxfq5m4#
唯一对我有用的是:
g52tjvyc5#
如果你打开了
pop up
,那么它将返回一个magnific object
,使用这个object
,你可以call
close method
。试试看
wj8zmpe16#
magnificPopup
iframe:bhmjp9jg7#
这是我关闭弹出窗口的唯一方法: