如果单击内容,为什么会弹出弹出式ajax框关闭 [英] why magnific popup ajax box closes if clicked on content
问题描述
请拜托请帮助我..我一直在尝试获取宏伟的弹出式ajax框来显示登录表单.似乎出现了表单,但是当我在表单或Ajax主体中的任何位置单击时,它便消失了.下面是代码
Please Please Please help me.. I have been trying to get the magnific popup ajax box to show login form. It seems that form appears but as soon as I click anywhere in form or ajax body, it disappears. below is the code
$(document).ready(function() {
$('.ajax-popup-link').magnificPopup({
type: 'ajax',
alignTop: false,
closeOnContentClick: false,
overflowY: 'scroll'
});
});
<a class=".ajax-popup-link" href="result.php">try me</a><br>
下面是我希望在ajax框中加载的php.这不是完整的
Below is the php that I look to load in ajax box. This is not the complete one
Email:<div class="field_container">Password:</label>
<input type='password' name='cust_password' id='password' maxlength="12" style="width: 250px; height: 30px"; /></div>
<input type='submit' name='Submit' value='Login' />
推荐答案
这是旧线程,但对于所有以后的读者:要解决此问题,从ajax发出的html中必须只有一个根元素致电:
This is the old thread but for all the future readers: to fix this, there has to be only one root element in the html that comes out from the ajax call:
根据文档:
http://dimsemenov.com/plugins/magnific-popup/documentation.html#ajax_type
因此在您的ajax调用中,您应该返回类似以下的内容:
So in your ajax call you should return something like this:
<div>
...your html content
</div>
,您的弹出窗口将不再因内容点击而关闭.
and your popup will no longer close itself on content click.
这篇关于如果单击内容,为什么会弹出弹出式ajax框关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!