宏伟的弹出窗口-弹出窗口在点击后消失 [英] Magnific Popup - Popup disappearing on click

查看:104
本文介绍了宏伟的弹出窗口-弹出窗口在点击后消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近刚刚实现了"Magnific Popup",并且弹出窗口显示的很好,但是当我单击一个输入框时,整个弹出窗口会消失回到父页面.在插件网站上显示的示例上,可以单击整个对话框,直到您在该对话框之外单击为止.

I've just recently implemented the 'Magnific Popup' and the popup comes up fine, however when I click an input box the entire popup disappears back to the parent page. On the examples shown on the plugin website, the entire dialog box is clickable until you click outside of that box.

我希望它只是我想念的非常简单的东西,但它仍在发挥我的作用.

I'm hoping its just something extremely simple I've missed, but it's still doing my head in.

我非常感谢我能获得的任何帮助!

I really appreciate any help I can get!

谢谢:)

推荐答案

如果使用的是"ajax"内容类型,则需要确保只有一个根节点.

If you're using "ajax" content type, you need to make sure that you've got only one root node.

http://dimsemenov.com/plugins/magnific-popup/documentation .html#ajax_type

例如,这是ajax文件的正确内容:

E.g., this is correct contents of ajax file:

<div>
    html content
    <script src="something.js"></script>
</div>

不正确:

<script src="something.js"></script>
<div>
    html content
</div>

不正确:

<div>
    html content
</div>
<div>Another content</div>

还要确保将closeOnContentClick设置为false http: //dimsemenov.com/plugins/magnific-popup/documentation.html#closeoncontentclick

如果出于某种原因无法更改ajax文件的内容,则可以解析parseAjax回调中的内容,如所述

If, for whatever reason, you can't change the contents of ajax file, you may parse content in parseAjax callback, like described here (so the mfpResponse.data contains only one root node).

这篇关于宏伟的弹出窗口-弹出窗口在点击后消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆