【问题标题】:Modal doesn't load content after it has been opened before模态在之前打开后不加载内容
【发布时间】:2011-10-16 07:02:30
【问题描述】:

这很奇怪,但是...

我们有这个代码:

jQuery(function($) {
    $('#basic-modal .basic').click(function(e) {
        $('#basic-modal-content').modal();

        return false;
    });
    $('#basic-modal-also .basic').click(function(e) {
        $('#basic-modal-also-content').modal();

        return false;
    });
});

启动两个模式窗口中的任何一个。

他们的代码是:

< !-- First Modal Window -->
<div id="basic-modal-content">
    <h3>Modal Window 2</h3>
    <p>any <strong>html</strong> content or images can go in here </p>
</div>

< !-- Second Modal Window -->
<div id="basic-modal-also-content">
    <h3>Modal Window 1</h3>
    <p>any <strong>html</strong> content or images can go in here </p>
</div>

我发现的是 onclick 我们启动了模式,它显示了它的内容。我们关闭它,当我们再次打开它时,它的内容是空的..

有什么明显的痛苦吗,我们是否需要刷新任何东西,或者我需要给你一些更多的代码?

我们使用 Eric Martins simplemodal 脚本。 http://www.ericmmartin.com/projects/simplemodal/

好吧,看来我们有冲突,不知道是什么原因造成的。

我们有 simplemodal 和 simplecountdown 。 简单模式代码:http://www.ericmmartin.com/projects/simplemodal/ 简单倒计时码:https://github.com/hilios/jquery.countdown/

想知道是否有人遇到过这种冲突。我还会在 Google 上询问 eric

【问题讨论】:

    标签: jquery modal-dialog


    【解决方案1】:

    很多时候,模态框会以某种方式处理或隐藏内容。模态脚本通常不考虑您可能再次打开它的事实。他们假设您只会打开它,在窗口中执行 XYZ,然后继续。我在这种情况下所做的一件事是每次触发模态时都通过 jQuery 重新加载内容,如果确实如此的话。我会用这个:

    $('#modal').html('

    任何html内容或图片都可以放在这里

    ');

    很难判断这是否真的是您的问题,但这是我在模态对话框中经常遇到的问题。

    【讨论】:

      猜你喜欢
      • 2022-06-30
      • 1970-01-01
      • 2011-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-24
      相关资源
      最近更新 更多