【问题标题】:closeOnContentClick does nothing - using Ajax gatheringcloseOnContentClick 什么都不做 - 使用 Ajax 收集
【发布时间】:2015-05-08 01:45:02
【问题描述】:

所以我有 Magnific Popup 插件设置,当您单击链接时,弹出窗口会出现。我希望这个弹出窗口包含与所述链接有关的所有信息。现在,我终于得到了正确设置和正确查看的所有内容,但我无法让 closeOnContentClick 工作。我读到这默认设置为 false ,当您单击内容时,它仍然会消失。我手动将其设置为 false,并且仍然执行相同的操作。这是否与出现的面板的宽度有关?我已经将它专门设置为 800px,但仍然搞砸了

Javascript:

$(document).ready(function() {
    $('#player_table').dataTable({
        "processing": true,
        "serverSide": true,
        "ajax": "serverside/handler.php"
            //"jQueryUI": true,
    });
    $(document).ajaxComplete(function() {
        $('.popup').magnificPopup({
            type: 'ajax',
            closeOnContentClick: false
        });
    });
});
$(function() {
    $("#tabs").tabs({
        beforeLoad: function(event, ui) {
            ui.jqXHR.fail(function() {
                ui.panel.html(
                    "Couldn't load this tab. We'll try to fix this as soon as possible. " +
                    "");
            });
        }
    });
});

Javascript 应该是调试所需的全部。但如果您需要 html,我可以提供。

这是 Ajax 响应。

    <div id="pop-form" class="white-popup">
    <center>
        <h2>You're currently viewing <? echo $values['username']; ?>'s Profile Analysis</h2>

        <? if ($result !="" ) { //NO ERRORS on load.. produce form ?>

        <!-- create page -->
        <div id="left">
            I'm Left
        </div>
        <div id="right">
            I'm Right
        </div>

        <? } else { //ERROR - needs to be noted echo $a1 . " - ERROR"; 
        }?>
    </center>
    <div style="clear:both;"></div>
</div>

【问题讨论】:

  • 请出示您的代码
  • @LeoFarmer 我添加了 Javascript

标签: javascript jquery html css magnific-popup


【解决方案1】:

您的代码看起来不错。

您需要确保您没有在 ajax 响应中返回 html 和 body 标记,因为这会导致 closeOnContentClick: false 停止正常工作。您的回复应该只包含在div 标签中。

【讨论】:

  • 我正在使用 PHP 响应。这会影响它吗?提供了代码,没有主要的 PHP 功能@leofarmer
猜你喜欢
  • 2016-03-11
  • 2021-01-13
  • 1970-01-01
  • 2020-12-08
  • 1970-01-01
  • 1970-01-01
  • 2020-10-16
  • 1970-01-01
  • 2019-03-08
相关资源
最近更新 更多