Magnific Popup - 弹出窗口在点击时消失 [英] Magnific Popup - Popup disappearing on click

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

问题描述

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

我希望它只是我错过的极其简单的东西,但它仍然在我脑海中.

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

谢谢:)

解决方案

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

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

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

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

不正确:

<script src="something.js"></script>

html内容</div>

不正确:

html内容</div><div>其他内容</div>

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

如果由于某种原因,您无法更改 ajax 文件的内容,则可以在 parseAjax 回调中解析内容,如 here(所以 mfpResponse.data 只包含一个根节点).

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!

Thanks :)

解决方案

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

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

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

Incorrect:

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

Incorrect:

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

Also make sure that closeOnContentClick is set to false http://dimsemenov.com/plugins/magnific-popup/documentation.html#closeoncontentclick

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).

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

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