Magnific Popup

编程入门 行业动态 更新时间:2024-10-27 18:31:21
本文介绍了Magnific Popup - 弹出窗口在点击时消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

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

谢谢:)

解决方案

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

dimsemenov/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 dimsemenov/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.

dimsemenov/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 dimsemenov/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

本文发布于:2023-08-06 02:13:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1309450.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Magnific   Popup

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!