【问题标题】:Changing the inner HTML in a SimpleModal dialog?在 SimpleModal 对话框中更改内部 HTML?
【发布时间】:2010-12-31 09:39:14
【问题描述】:

我正在使用 jQuery 表单插件的 beforeSubmit 函数来关闭一个模态对话框,并且我希望在之后弹出另一个带有表单提交结果的对话框,所以我在成功中放置了另一个模态函数并通过responseText...但是新的模态对话框永远不会弹出...我怎样才能让它弹出?我也想知道如何改变对话框的innerHTML。我试过 dialog.data.html(responseText);和其他一些东西,但没有一个起作用。

这是表单提交的代码:

$('#member_ban_forum').ajaxForm( { 
    data: { member: member }, beforeSubmit: function() { 
        $.modal.close();
    },

    success: function (responseText) {
        $().delay(5000, function () {
            simpleModal(responseText);
        });
    }
});

这是我制作的 simpleModal 弹出函数的代码:

function simpleModal ( html ) {
    $(html).modal({
        containerCss:{
            height:340,
            width:450
        },

        onOpen: function (dialog) {
            dialog.overlay.fadeIn(350, function () {
                dialog.container.fadeIn(350, function () {
                    dialog.data.slideDown(350);
                });
            });
        },

        onClose: function (dialog) {
            dialog.data.slideUp(350, function () {
                dialog.container.fadeOut(350, function () {
                    dialog.overlay.fadeOut(350, function () {
                        $.modal.close();
                    });
                });
            });
        }
    });
}

【问题讨论】:

  • 突出显示整个代码块并单击{} 按钮将其分隔为 4 个空格...这启用了降价代码格式 :)
  • 是的,抱歉,第一次在堆栈溢出时发帖。也是一段时间以来我第一次无法使用谷歌找到问题的答案:(
  • 你的代码会吓跑任何人..
  • 已经修好了 -_- 现在应该间隔很好。

标签: php jquery modal-dialog simplemodal


【解决方案1】:

我可能是错的,但我认为问题在于您使用 delay()

以下对我有用:

$('#member_ban_forum').ajaxForm( { 
    data: { member: member },
    beforeSubmit: function() { 
        $.modal.close();
    },
    success: function (responseText) {
        setTimeout(function () {
            simpleModal(responseText);
        }, 5000);
    }
});

【讨论】:

  • 是的,这就是我最终修复此问题的方式,我还最终使用“simplemodal-wrap”类更改了 div 中的 HTMl。还有其他方法可以更改模态中的内容吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多