iframe 父级的宏伟弹出目标

Magnific popup target to iframe parent

我有一个带有一些小 iframe 的网页,当用户单击 iframe 中的一个按钮时 - 显示带有 type: inline 的大表单。如何让弹出窗口在父页面中打开?

如果您是子 iframe 的所有者,则可以添加 clickHandler 以触发父级中的某些自定义。请看MDN

例如。 parent.$('body').trigger('custom:event');

已编辑 在最新版本中 - 更容易。 作者添加参数 prependTo

 var conf = {type: 'inline', preloader: false};
 if (window.location != window.parent.location) {
     conf.prependTo = window.parent.$('body');
 }

完成。丑陋的小黑客 添加新选项 - target

var conf = {type: 'inline', preloader: false};
if (window.location != window.parent.location) {
    conf.target = $(window.parent.window);
}

在源代码中,在函数中 addGroup

if (typeof options.target != 'undefined') {
    _window = options.target;
} else {
    _window = $(window);
}